Bug #17987: require() not permitted within class definition

From: Date: Wed, 26 Jun 2002 04:30:27 +0000
Subject: Bug #17987: require() not permitted within class definition
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-12093@lists.php.net to get a copy of this message
From: david-work@robinson-au.net Operating system: Windows 2000 PHP version: 4.2.0 PHP Bug Type: Class/Object related Bug description: require() not permitted within class definition Hello The include() and require() statements do not work within a class definition. This may be a parsing problem, or it may behave as designed. See below for an example script and the errors generated. I am running the precompiled binary downloaded from the php.net website. Many thanks David Robinson *** Example 1 <?PHP class test { function f1() { ... } include('file.php'); function f2() { ... } } ?> *** End Example 1 *** Error 1 Parse error: parse error, unexpected T_INCLUDE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' ... *** End Error 1 *** Error 2 Parse error: parse error, unexpected T_REQUIRE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' ... *** End Error 2 -- Edit bug report at http://bugs.php.net/?id=17987&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17987&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17987&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17987&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17987&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17987&r=support Expected behavior: http://bugs.php.net/fix.php?id=17987&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17987&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17987&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17987&r=globals

« previous php.bugs (#12093) next »