ID:               23384
 Updated by:       [EMAIL PROTECTED]
 Reported By:      thixit at yahoo dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Zend Engine 2 problem
 Operating System: Windows 98
 PHP Version:      5CVS-2003-04-28 (dev)
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

The first form will not work, since it is ambigious, so I don't think
it is possible to make it work right. The second form should be working
now. 


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

[2003-04-28 11:44:23] thixit at yahoo dot com

The following codes didn't work as expected. There're two problems that
I don't understand.

First, PHP doesn't know about defined constant if test() is called from
subclass.

<?php
define('TEN', 10);
class Foo {
    function test() {
        static $arr = array(TEN => 'ten');

        print_r($arr);
    }
}

class Bar extends Foo {
}

Foo::test();    // output: Array([10] => ten)
Bar::test();    // output: Array([TEN] => ten)
?>


Second, as commented, it doesn't know about const TEN too.

<?php
class Foo {
    const TEN = 10;
    function test() {
        // --- PHP will complain about this
        // static $arr = array(TEN => 'ten');

        // --- This line cause $arr to be an empty array
        //     without any error
        static $arr = array(Foo::TEN => 'ten');

        print_r($arr);
    }
}

Foo::test();    // output: Array()
?>


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


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

Reply via email to