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

 ID:               52439
 Updated by:       [email protected]
 Reported by:      shiranai7 at hotmail dot com
 Summary:          Static and non-static variable name collision in a
                   class declaration
-Status:           Open
+Status:           Bogus
 Type:             Bug
 Package:          Class/Object related
 Operating System: Win
 PHP Version:      5.3.3

 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------
[2010-07-25 17:48:33] shiranai7 at hotmail dot com

Description:
------------
It seems impossible to have two variables - one static and one not -
with same name in a class declaration. But these are two completely
different variables!

Test script:
---------------
<?php

// this results in a fatal error

class Test {

    public static $Foo = 'iamstatic';

    public $Foo = 'iamNOTstatic';

}

// this works

class Test {

    public static $Foo = 'iamstatic';

}

$Baz = new Test();

$Baz->Foo = 'iamNOTstatic';

echo $Baz->Foo."\n";

echo Test::$Foo;

/* Result:

iamNOTstatic

iamstatic

*/

?>

Expected result:
----------------
No errors.

Actual result:
--------------
Fatal error: Cannot redeclare Test::$Foo in *path* on line 6


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



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

Reply via email to