ID: 27406 Comment by: de_bruut at hotmail dot com Reported By: thomas at stauntons dot org Status: Assigned Bug Type: Unknown/Other Function Operating System: OS X PHP Version: 5.0.2-dev Assigned To: iliaa New Comment:
"How should the docs be changed? This misfeature hasn't been dealt with yet...maybe we should just remove the docs :)" What misfeature? IMO a function that can check the syntax of a PHP file before it's included has real benefits for development and testing (as it can be used to avoid parse and fatal errors etc). And the documentation of php_check_syntax perfectly describes such a function. The only problem here is the fact that php_check_syntax not only checks the code, but executes it as well. I'd say that this is unexpected, undesirable behavior (a bug). The documentation is just fine the way it is now... Previous Comments: ------------------------------------------------------------------------ [2004-09-20 21:36:57] [EMAIL PROTECTED] How should the docs be changed? This misfeature hasn't been dealt with yet...maybe we should just remove the docs :) ------------------------------------------------------------------------ [2004-09-16 18:19:12] didou at keliglia dot com "So should this function actually execute the code (like an include()) or should it be a simple lint check (identical to php -l)" It should do only a lint check, otherway we don't need this function as we already have include.. Anyway, we should really change the docs philip. ------------------------------------------------------------------------ [2004-08-26 18:20:05] [EMAIL PROTECTED] Tested latest CVS on a Win32 machine, same problem. Here's a very simple test: randominclude.php <?php function foobar() { echo "HI"; } ?> checksyntax.php <?php if (php_check_syntax('randominclude.php')) { echo "passed"; foobar(); } ?> Calling checksyntax.php via Module/CLI/CGI results in: passedHI As opposed to: passed Fatal error: Call to undefined function foobar() in ... ------------------------------------------------------------------------ [2004-08-09 05:10:33] [EMAIL PROTECTED] So should this function actually execute the code (like an include()) or should it be a simple lint check (identical to php -l). The doc team assumed the later. Please advise with specific information on how this should be documented or if this is indeed a bug, say so. http://cvs.php.net/co.php/phpdoc/en/reference/misc/functions/php-check-syntax.xml ------------------------------------------------------------------------ [2004-08-08 18:59:20] phpbug at bigredspark dot com Bogus? Could someone document this function so we know what the "proper" usage is? Is this funtion meant to load the file into the current scope as it's syntax is checked? If so, please say so in the documentation. Otherwise, I have another bug report to file. original.php <?php $bool = php_check_syntax('checkme.php'); foo(); $bar = new Bar; $bar->foo(); ?> checkme.php <?php function foo() { echo "checkme::foo\n"; } class Bar { function foo() { echo "checkme::bar::foo\n"; } } ?> results in checkme::foo checkme::bar::foo for example, when my assumption of how the function works should have the code results in undefined function and class errors. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/27406 -- Edit this bug report at http://bugs.php.net/?id=27406&edit=1