Re: About bug #26182..(Object properties created redundantly)

From: Date: Tue, 02 Dec 2003 13:11:37 +0000
Subject: Re: About bug #26182..(Object properties created redundantly)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-5996@lists.php.net to get a copy of this message
I commited a fix. I am not quite sure why the existing code was doing what it was so I'm waiting for Zeev (who wrote that part) to verify that my fix is OK. (He's travelling right now so it'll take some time). In the meanwhile, if any of your scripts break because of my fix please let me know. Andi At 08:53 PM 12/1/2003 +0200, Jani Taskinen wrote:
    This script:
<?php class A {
        function NotAConstructor(){
                if(isset($this->x)){
                        //just for demo
                }
        }
} $t=new A(); var_dump($t); ?>
    Output with php4:
object(a)(0) { }
    Output with php5:
object(a)#1 (1) { ["x"]=> NULL }
    The property x gets created by that check if it exists in the class..
    Pretty high WTF factor IMO. And someone might rely that a property STAYS
    unset even if they happen to check it in their methods.
    --Jani


« previous php.internals (#5996) next »