I've a little issue with exception, however this isn't particular
    bound to the new mechanism and existed before.

    When calling a static method of a class from an objects method, the
    stack trace does not reveal the class name of the static class
    containing the static method.


    Example:
$ cat test_exception.php
<?php
        class StaticClass {
                function staticMethod() {
                        throw new Exception("example");
                }
        }

        class InstantiateMe {
                function method() {
                        #throw new Exception("example");
                        StaticClass::staticMethod();
                }
        }

        $obj = new InstantiateMe;
        $obj->method();
?>


    Output:
$ php test_exception.php

Fatal error: Uncaught exception 'exception' with message 'example' in 
/home/mfischer/htdocs/php5/test_exception.php:4
Stack trace:
#0 /home/mfischer/htdocs/php5/test_exception.php(11): InstantiateMe->staticMethod()
#1 /home/mfischer/htdocs/php5/test_exception.php(16): InstantiateMe->method()
#2 {main}
  thrown in /home/mfischer/htdocs/php5/test_exception.php on line 4



    Of special interest, see #0 containing the line:

        InstantiateMe->staticMethod()

    instead of e.g.

        StaticClass::staticMethod()

    At least, saying 'InstantiateMe->' looks wrong to me as I'm calling
    'StaticClass::' actually.

    - Markus

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

Reply via email to