|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-09-25 06:29 UTC] john@php.net
Description:
------------
ZE2 is bailing on with a fatal error when calling a method dyanmically using a properity of the class (an array) as the dynamic function name. I.e.
$this->myarr[0]("function paramer");
returns:
Fatal error: Method name must be a string in....
It worked in PHP4, so I don't know if this is intended as invalid in PHP5, or if it is a bug...
Reproduce code:
---------------
<?php
class foo {
var $arr = array("test");
function test($var) {
echo "Test $var";
}
}
$a = new foo();
echo "<PRE>"; var_dump($a); echo "</PRE>";
$a->arr[0]("testvalue");
?>
Expected result:
----------------
Test testvalue
Actual result:
--------------
Fatal error: Method name must be a string in...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 18:00:02 2025 UTC |
Opps. Bad code example -- this is the code: <?php function test($var) { echo "Test $var\n"; } class foo { var $arr = array("test"); function bar() { $this->arr[0]('testvalue'); } } $a = new foo(); $a->bar(); ?>