Re: php_check_syntax loads functions and classes
| From: | John Holmes | Date: | Sun, 08 Aug 2004 16:17:58 +0000 |
| Subject: | Re: php_check_syntax loads functions and classes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-193137@lists.php.net to get a copy of this message | ||
Michael Scholl wrote:
I'm running PHP 5.0.0 with Apache 2.0.50 and have a problem with the php_check_syntax function. When I use it, it loads all functions ans classes. But I only want to check the syntax, not to load the files. Is this a bug or a feature ?I'd say it was a bug, but since the function isn't really documented, it's hard to say what the intent of the function is. There's already this bug regarding the second parameter: http://bugs.php.net/bug.php?id=29454 This function seems really screwy anyhow. If I have a function foo() in the file I'm checking and a function foo() in the main PHP file declared after I check the syntax... I'll get a failure for checking the syntax of the file... even though there isn't one. test.php <?php $b = php_check_syntax('test1.php'); if(!$b) { echo 'Error in syntax'; } function foo() { echo 'test.php::foo'; } foo(); ?> test1.php <?php function foo() { echo 'test1.php::foo'; } ?> I get the "Error in syntax" message although test1.php loads without error on it's own and the foo() call outputs "test.php::foo"... I'm going to open up a bug report and go over some of this. Seems like a very handy function to have if it worked correctly. -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com