Hi list,

I am aware this question might have been discussed to death but I did some googling on $subject and watched the bug/feature tracker and it seems most entries on this issue are old and unanswered.

Is there a design decision or hard-to-overcome engine limitation which prevents turning method-on-nonobject into a catchable Exception? Or did just nobody step up and provide a patch?

Rationale:

In another language/framework context I did a lot of chained/nested stuff like this:

$granny_name = $baby->getMother()->getMother()->getName();

In PHP I would rather do

$mother = $baby->getMother();

if ($mother) {
    $granny = $mother->getMother();
    if ($granny) {
        $granny_name  = $granny->getName();
    }
}

because I have no way to catch if $mother or $granny cannot be retrieved.

If it's generally welcome I'll try and supply a patch.

(Now let's hope this doesn't start something evil.)

--
Ralf Lang
Linux Consultant / Developer
Mail: l...@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to