php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58245 Extending HttpMessage bit buckes member variables
Submitted: 2008-06-23 18:56 UTC Modified: 2008-07-11 12:45 UTC
From: joe at digg dot com Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.2.0 OS: Debian/GNU 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:
30 + 40 = ?
Subscribe to this entry?

 
 [2008-06-23 18:56 UTC] joe at digg dot com
Description:
------------
I'm trying to use HttpMessage to loosely couple interacting 
with requests in the application framework we're using here at 
Digg and ran across some really bizarre behavior. 

The problem is that when I extend HttpMessage, create a member 
variable and then attempt to write to that variable the write 
is bit-bucketed. 

Reproduce code:
---------------
<?php

class Foo
{
    protected $foo = null;
    public function test()
    {
        $this->foo = $_SERVER['SERVER_NAME'];
        var_dump($this->foo);
    }
}

class Bar extends HttpMessage
{
    protected $foo = null;
    public function test()
    {
        $this->foo = $_SERVER['SERVER_NAME'];
        var_dump($this->foo);
    }
}

$foo = new Foo();
$foo->test();

$bar = new Bar();
$bar->test();

// Results in the host from Foo and NULL from Bar

?>


Expected result:
----------------
Uh ... assigning to member variables should work? At the 
*very* least I should be able to assign to member variables I 
declare myself. 

Actual result:
--------------
Values are not assigned to member variables I've declared. 
This is forcing me to, essentially, use the decorator pattern 
as (along with HttpMessage::fromEnv() not firing my child 
class's constructor) extending this class yields unexpected 
results.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-11 12:45 UTC] mike@php.net
This bug has been fixed in CVS.

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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC