|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-07-11 12:45 UTC] mike@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 06:00:01 2025 UTC |
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.