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

From: Date: Wed, 26 Jun 2002 04:48:02 +0000
Subject: Bug #17987 Updated: require() not permitted within class definition
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-12095@lists.php.net to get a copy of this message
ID: 17987 Updated by: alan_k@php.net Reported By: david-work@robinson-au.net -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Windows 2000 PHP Version: 4.2.0 New Comment: Sorry, but the bug system is not the appropriate forum for asking support questions. Your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php Thank you for your interest in PHP. thats designed behaviour = put the include outside the class or inside the function/methods. Previous Comments: ------------------------------------------------------------------------ [2002-06-26 00:30:27] david-work@robinson-au.net 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 this bug report at http://bugs.php.net/?id=17987&edit=1

« previous php.bugs (#12095) next »