Re: String passed to object constructor turning into an instance of that object?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 16, 2010 at 4:04 PM, Kris Deugau <kdeugau@xxxxxxxxx> wrote:

> Nathan Nobbe wrote:
>
>> 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?
>>
>
> function Tag($tag='', $tagContent='') {
>  $this->tagContent = $tagContent;
>  $this->tag = $tag;
>  $this->showEndTag = false;
>
>  $this->attributes = array();
>  $this->children = array();
>
> }
>

seems innocuous ..


>
>  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).
>>
>
> Mmm.  I hoped this would help, but all it seems to have done was cascade
> errors across the rest of Tag's object children.  :(


to be expected, but did it fix the problem w/ SelectBoxOption?


> Copying the old constructor back in resolved that, but I'm not sure whether
> that reintroduces the root problem.


> Other objects derived from Tag seem to work just fine;  I came into this
> chunk of the code trying to find out why a SelectBoxOption didn't seem to
> have a toString function - and then why trying to access what should be the
> value and name the same way as with other objects derived at some level from
> Tag blew up instead of working happily.
>
> I'll try converting all of the constructors to your recommendation as
> above, but given that the problem is only happening with this one class, I'm
> not sure that will do much.
>

hopefully that clears it up .. and hopefully you're using version control :D

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux