On Thu, Dec 16, 2010 at 3:21 PM, Kris Deugau <kdeugau@xxxxxxxxx> wrote: > Nathan Nobbe wrote: > >> Why not test for the type of $name at each point of interest in the >> SelectBoxOption >> constructor? If you're passing a string value to the constructor it >> almost >> has to be getting changed by the Tag constructor, right ? >> >> class SelectBoxOption extends Tag { >> function SelectBoxOption($name, $value, $selected=false) { >> >> var_dump(is_string($name)); >> >> parent::Tag("option", $name); >> >> var_dump(is_string($name)); >> > > Ah, that gives... well, it slightly alters the confusion. > > Using var_dump(is_string($name)) gives... two results? > > bool(true) > bool(false) > > And dumping $name itself gives: > > string(8) "Abegweit" > object(SelectBoxOption)#65 (5) { ["attributes"]=> array(1) { [0]=> > object(TagAttribute)#66 (3) { ["name"]=> string(5) "value" ["value"]=> > string(1) "4" ["hasValue"]=> bool(true) } } ["tagContent"]=> string(8) > "Abegweit" ["tag"]=> string(6) "option" ["showEndTag"]=> bool(false) > ["children"]=> array(0) { } } > > O_o > > Just to confirm, I checked a test instance of the site on CentOS 4, with > PHP 4.3, and I get one "bool(true)" for each <option> - not two as is > happening with PHP 5.2. > probly something screwy going on w/ the old style of naming constructors. 2 things, 1. can you post the Tag constructor as it reads now? 2. try modifying Tag & SelectBoxOption to have __construct() instead of Tag() & SelectBoxOption(), then call parent::__construct() from inside of SelectBoxOption::__construct(); see if that clears up your problem under 5.2 (read: this will only be a partial solution as it only addresses one child of Tag). > -kgd > > (I haven't worked with PHP for quite a while, and I never really spent a > lot of time getting deep into complex data structures and object hierarchies > like this when I was using it. But this behaviour does NOT match what I > know of passing values and object references around in any other language.) > Probly because the term 'reference' in php means something rather different than it does in say java for example.