ID: 17290 Comment by: Matt_B at TinyOnline dot co dot uk Reported By: mellow at mellow dot dk Status: No Feedback Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 4.1.2 New Comment:
I've just had the same problem, from changing a variable from global, to class specific. After some confusion I realised I forgot to remove the $, just like in your example: $this->$resultado_array[] should be $this->resultado_array[] and then it all works fine. Previous Comments: ------------------------------------------------------------------------ [2006-04-18 19:03:41] oliver at samera dot com dot py Seems to be a class related bug, here is a simple test-case: <?php // php 4.3.9 - CentOS 4.3 - [EMAIL PROTECTED] - 18-apr-2006 // ----------------------------------------------------------------------------- class cache_db { var $resultado_array; function cache_db() { $this->$resultado_array = array(); } // abre un archivo y lo carga en memoria function cache_open() { $archivo_array = array(array('1'), array('2'), array('3')); $resultado_array = array(); foreach($archivo_array as $linea) { $resultado_array[] = $linea; $this->$resultado_array[] = $linea; } } } // without a class $archivo_array = array(array('1'), array('2'), array('3')); $resultado_array = array(); foreach($archivo_array as $linea) { $resultado_array[] = $linea; } ?> ------------------------------------------------------------------------ [2006-03-18 21:17:37] 7l9it46r1adm1l1 at jetable dot com I got the same strange Fatal error (using Windows XP, PHP PHP 5.0.4): Fatal error: Cannot use [] for reading in ... on line 82 [php] if ($insert->check($_POST['value']) === FALSE) { $error[] == 'Error'; // line 82 } [/php] Zend Developer didn't give any warnings so there shouldn't be any syntax mistakse in that PHP file. ------------------------------------------------------------------------ [2002-08-11 01:00:13] php-bugs at lists dot php dot net No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2002-07-10 23:25:46] [EMAIL PROTECTED] Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. We need a self-contained and SHORT example script which shows the problem.. ------------------------------------------------------------------------ [2002-06-26 14:09:48] robjohnwilson at hotmail dot com I seem to be getting this error also in 4.2.1 running on SunOS - is this possible? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/17290 -- Edit this bug report at http://bugs.php.net/?id=17290&edit=1