You are here: Re: [PHP] include/include_once php_check_syntax() / E_PARSE errors « PHP « IT news, forums, messages
Re: [PHP] include/include_once php_check_syntax() / E_PARSE errors

Posted by Curt Zirzow on 11/16/05 05:18

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.
--

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация