note 56588 rejected from language.oop5.paamayim-nekudotayim by mazzanet
| From: | mazzanet@php.net | Date: | Thu, 08 Sep 2005 09:44:45 +0000 |
| Subject: | note 56588 rejected from language.oop5.paamayim-nekudotayim by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-94902@lists.php.net to get a copy of this message | ||
Note Submitter: civilization_2 at hotmail dot com
----
A small note/question regarding migration from php4 to php5 ...
Take for example this piece of code:
<?
class Test1 {
public function f1() {
print_r(debug_backtrace());
}
}
class Test2 extends Test1 {
}
Test1::f1();
Test2::f1();
?>
Under php4 the result is:
<?
Array
(
[0] => Array
(
[file] => test.php
[line] => 11
[function] => f1
[class] => test1
[type] => ::
[args] => Array
(
)
)
)
Array
(
[0] => Array
(
[file] => test.php
[line] => 12
[function] => f1
[class] => test2
[type] => ::
[args] => Array
(
)
)
)
?>
Under php5 the result is:
<?
Array
(
[0] => Array
(
[file] => test.php
[line] => 11
[function] => f1
[class] => Test1
[type] => ::
[args] => Array
(
)
)
)
Array
(
[0] => Array
(
[file] => test.php
[line] => 12
[function] => f1
[class] => Test1
[type] => ::
[args] => Array
(
)
)
)
?>
I know the class names are now case-sensitive ... but under php5 The class name in the second
function call has now changed from the class called (Test2) to the class containing the function
(Test1)!
Is this a bug or the new way that php5 just works?
If this is by design, then does anyone know how I can get the name of the class called?
Thanks.