php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58972 responseMessage property is private with little options for overloading send()
Submitted: 2009-12-02 15:06 UTC Modified: 2009-12-30 10:09 UTC
From: grant dot kidd at gmail dot com Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.2.1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
41 - 25 = ?
Subscribe to this entry?

 
 [2009-12-02 15:06 UTC] grant dot kidd at gmail dot com
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-30 10:09 UTC] mike@php.net
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

Now one can set the message class HttpRequest is going to use.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 15:01:28 2024 UTC