|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-07-30 18:49 UTC] cataphract@php.net
-Status: Open
+Status: Bogus
[2011-07-30 18:49 UTC] cataphract@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 14:00:01 2025 UTC |
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 )