note 75890 added to function.debug-backtrace
| From: | php at kennel17 dot co dot uk | Date: | Wed, 20 Jun 2007 16:01:02 +0000 |
| Subject: | note 75890 added to function.debug-backtrace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127830@lists.php.net to get a copy of this message | ||
The value of the class argument has changed slightly between PHP4 and PHP5:
Here's an example:
<?php
function get_class_static() {
$bt = debug_backtrace();
$name = $bt[1]['class'];
return $name;
}
class foo {
function printClassName() {
print(get_class_static() . "\n");
}
}
class bar extends foo {
}
$f = new foo();
$b = new bar();
$f->printClassName();
$b->printClassName();
?>
In PHP4 you get:
foo
bar
In PHP5 you get:
foo
foo
debug_backtrace() now sets the 'class' parameter to be the class that the function is
actually defined in, not the name of the instantiated class.
----
Server IP: 87.124.64.96
Probable Submitter: 85.210.211.75
----
Manual Page -- http://www.php.net/manual/en/function.debug-backtrace.php
Edit -- https://master.php.net/note/edit/75890
Del: integrated -- https://master.php.net/note/delete/75890/integrated
Del: useless -- https://master.php.net/note/delete/75890/useless
Del: bad code -- https://master.php.net/note/delete/75890/bad+code
Del: spam -- https://master.php.net/note/delete/75890/spam
Del: non-english -- https://master.php.net/note/delete/75890/non-english
Del: in docs -- https://master.php.net/note/delete/75890/in+docs
Del: other reasons-- https://master.php.net/note/delete/75890
Reject -- https://master.php.net/note/reject/75890
Search -- https://master.php.net/manage/user-notes.php