Re: Class autoload patch
| From: | Ivan Ristic | Date: | Mon, 03 Jun 2002 13:13:59 +0000 |
| Subject: | Re: Class autoload patch | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-84769@lists.php.net to get a copy of this message | ||
If you are having problems with the attachment from my
previous email, the patch is available for download here:
http://www.webkreator.com/download/class_autoload.patch
> I have written this small patch to support class autoloading. It
> is written in the spirit of the unserialize callback (see
> http://www.php.net/manual/en/function.unserialize.php) and uses
> the same callback function.
>
> Can someone with write access to CVS please commit the patch?
>
> I assume that this is a safe thing to do because the same
> mechanism is already in use in the production code.
>
> Example:
>
> function _autoload($classname) {
> @include_once("class.$classname.php");
> }
>
> ini_set("unserialize_callback_func", "_autoload");
>
> // the following will work even if class X has
> // not be defined so far
> $x = new X();
--
Ivan Ristic, ivanr@webkreator.com
[ Weblog on PHP, Software development, Intranets,
and Knowledge Management: http://www.webkreator.com ]