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

 ID:                 55321
 Updated by:         cataphr...@php.net
 Reported by:        deminy at deminy dot net
 Summary:            PHP Notice:  Use of undefined constant self
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Variables related
 Operating System:   Ubuntu 11.04 (64 bit)
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 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:
------------------------------------------------------------------------
[2011-07-29 22:13:47] deminy at deminy dot net

Description:
------------
When running the test script with PHP 5.3.6 (and PHP 5.3.5) on Ubuntu 11.04 (64 
bit) from command line, following message shown up.

PHP Notice:  Use of undefined constant self - assumed 'self' in 
/path_to_the_PHP_script on line 5
PHP Stack trace:
PHP   1. {main}() /path_to_the_PHP_script:0
PHP   2. TestArray::flatten() /path_to_the_PHP_script:25

The test script runs fine with PHP 5.3.5 on Ubuntu 11.04 (32 bit).

Test script:
---------------
<?php
class TestArray {
        public static function flatten(array $arr) {
                $data = array();
                array_walk_recursive($arr, array(self, 'appendToArray'), 
&$data);
                return $data;
        }

        protected static function appendToArray($val, $key, array &$arr) {
                $arr[] = $val;
        }
}

$arr = array(
        'a',
        array(
                'b',
                array(
                        'c',
                        'd',
                ),
        ),
);

print_r(TestArray::flatten($arr));
?>


Expected result:
----------------
Array
(
    [0] => a
    [1] => b
    [2] => c
    [3] => d
)


Actual result:
--------------
PHP Notice:  Use of undefined constant self - assumed 'self' in 
/path_to_the_PHP_script on line 5
PHP Stack trace:
PHP   1. {main}() /path_to_the_PHP_script:0
PHP   2. TestArray::flatten() /path_to_the_PHP_script:25
Array
(
    [0] => a
    [1] => b
    [2] => c
    [3] => d
)



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



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

Reply via email to