Date: 06/18/01
- Next message: sniper <email protected>: "[PHP-DEV] Bug #11101 Updated: Php has caused an error in PHP4TS.DLL"
- Previous message: alban.hertroys <email protected>: "[PHP-DEV] Bug #11486: Oracle connection resource disappears in nested connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 11226
User Update by: mikehatesspam <email protected>
Old-Status: Feedback
Status: Open
Bug Type: Scripting Engine problem
Operating system: Linux 2.4.2 (Redhat Linux 7.1)
PHP Version: 4.0.4pl1
Description: Unable to reference functions inside a class via "Variable Funcitons"
I modified the code like this:
<?
function xyz() {
echo "This always works";
}
class test {
function testfunc() {
echo "This now works";
}
function calltest() {
$function_name = 'test::testfunc';
$function_name();
}
}
$t = new test;
$t->calltest();
?>
I got the exact same error. I just don't think it can find functions inside a class.
Previous Comments:
---------------------------------------------------------------------------
[2001-06-18 10:16:18] kalowsky <email protected>
i do believe you need to declare the function testfunc() BEFORE you try to reference it. try that and see if it works.
---------------------------------------------------------------------------
[2001-05-31 18:32:36] mikehatesspam <email protected>
When I run this script I get this error message:
Fatal error: Call to undefined function: test::testfunc() in
/var/www/html/database/classes/Authenticator/test.php on line 9
I can execute the function by using test::testfunc();
directly, but not by using "Variable Functions". I can also
change $function_name to be 'xyz' and it then works.
<?
class test {
function calltest() {
$function_name = 'test::testfunc';
$function_name();
}
function testfunc() {
echo "This now worksn";
}
}
function xyz() {
echo "This always worksn";
}
$t = new test;
$t->calltest();
?>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=11226
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: sniper <email protected>: "[PHP-DEV] Bug #11101 Updated: Php has caused an error in PHP4TS.DLL"
- Previous message: alban.hertroys <email protected>: "[PHP-DEV] Bug #11486: Oracle connection resource disappears in nested connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

