Re: include/include_once php_check_syntax() / E_PARSE errors

From: Date: Wed, 16 Nov 2005 03:18:13 +0000
Subject: Re: include/include_once php_check_syntax() / E_PARSE errors
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-225885@lists.php.net to get a copy of this message
On Tue, Nov 15, 2005 at 10:48:56PM +0000, Thiago Silva wrote: > ... > So, __autload has to *try* include_once's. Something like that: > > function __autoload($className) { > include_once("${className}.php"); > if(class_exists($className, false)) return; > > include_once("${className}.class.php"); > if(class_exists($className, false)) return; > > die("class not found: $className"); > } > > Then, loading Smarty would generate a warning message because the first > include_once tries to load Smarty.php (wich doesn't exists). > > ... > Having explained the problem, I would like to know: > > 1: Is there an elegant way to resolve this? For third party classes I usually extend it myself with my own naming convention, so like with smarty I would create a class like: Template.php: <?php require_once('path/where/smartyis.php'); class Template extends Smarty { } > > 2: What happened to php_check_syntax? It was removed for technical reasons. one option is to use: http://php.net/runkit > 3: What was the final word about include() behavior regarding E_PARSE error? > Reading and searching the bug database, I read some posts that seemed to > indicate that include() should *not* halt on E_PARSE errors, but then, php5 > does halt the execution. > > 4: Halting the execution on E_PARSE error generated through an include() is > a coherent/expected behavior? (it doesn't seem to me). > > 5: Why? (depending on the answer to that question, I'll head to > bugs.php.net). This does seem odd. http://bugs.php.net/bug.php?id=31736 It seems it was fixed then, although 5.1 seems to be broke for me. 5.0 is fine. Curt. --

« previous php.general (#225885) next »