ID:               22512
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ziya at atilim dot edu dot tr
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Any
 PHP Version:      4.3.1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

next time post your questsions on [EMAIL PROTECTED] first
before filing a bogus bug report. use:

class Test{
        var $myVar;
        
        function Test($val){
                if (is_null($val))
                        $this = NULL;
                else 
                        $this->myVar = $val;
        }
}



Previous Comments:
------------------------------------------------------------------------

[2003-03-03 02:39:27] ziya at atilim dot edu dot tr

When we return NULL from the constructor, our intend is to tell caller
that NO OBJECT IS CREATED. But in PHP this case does not work.

Please check the following example;
<?php

class Test{
        var $myVar;
        
        function Test($val){
                if (is_null($val))
                        return NULL;
                else 
                        $this->myVar = $val;
                return $this;
        }
}

$a = NULL;

$t = new Test($a);

if (is_object($t))
        echo "Although it must be NULL, it says OBJECT";

?>
                        
I am developing a very huge API using PHP and this does not permit us
to continue. I think, there should be a way of doing this in a language
which support OOP constructs.

Sincerely,
Ziya Karakaya

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=22512&edit=1

Reply via email to