|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-12-30 10:09 UTC] mike@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 13:00:02 2025 UTC |
Description: ------------ I'm attempting to write classes that extend HttpRequest and HttpMessage. According to the PHP.net documentation, all the properties for HttpRequest class are protected. As such, I should allow me to send an HttpRequest, intercept the return value, create a new HttpMessage using the factory method and save that new class to the responseMessage property. Currently there is no way to set the responseMessage property for HttpRequest. Reproduce code: --------------- class Client extends HttpRequest { public function send() { $response = parent::send(); $this->responseMessage = Client_Message::factory($this->getRawResponseMessage()); return $this->getResponseMessage(); } } class Client_Message extends HttpMessage { public static function factory($raw_message = null, $class_name = null) { return parent::factory($raw_message, get_class()); } } $c = new Client('http://www.google.com'); $c->send() print get_class($c->getResponseMessage()); Expected result: ---------------- Client_Message Actual result: -------------- HttpMessage