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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to