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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: grant dot kidd at gmail dot com
New email:
PHP Version: OS:

 

 [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: Thu Apr 25 17:01:29 2024 UTC