On Fri, 2010-01-29 at 13:02 +0800, Eric Lee wrote:
> Hi php-dev pros,
>
> I got an issue about catching exception throw from __autoload on php 5.3.1.
>
> The manual state that exception throw from __autoload could be catched with
> try.. catch statement same as the normal flow.
>
> But I'can archive that even I have copied the same sample code from the
> manual.
>
> Here are the code segment.
>
> [[[
> function __autoload($name) {
> echo "Want to load $name.\n";
> throw new Exception("Unable to load $name.");
> }
>
> try {
> $obj = new NonLoadableClass();
> } catch (Exception $e) {
> echo $e->getMessage(), "\n";
> }
>
> ]]]
>
> Are there anyone experienced this or not ?
>
> Thanks in advance !
>
> Regards,
> Eric,
What version of PHP are you using? The example will only work on PHP
version 5.3.0 and above
Thanks,
Ash
http://www.ashleysheridan.co.uk