#48847 [Opn->Fbk]: debug_backtrace() doesn't reference arguments in stack in some cases

From: Date: Tue, 25 Aug 2009 07:21:43 +0000
Subject: #48847 [Opn->Fbk]: debug_backtrace() doesn't reference arguments in stack in some cases
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-141469@lists.php.net to get a copy of this message
ID: 48847 Updated by: sjoerd@php.net Reported By: an0nym at narod dot ru -Status: Open +Status: Feedback Bug Type: Scripting Engine problem Operating System: * PHP Version: 5.2.10, 5.3.0 New Comment: Thank you for your bug report. Why do you think it should be possible what you are trying to do? The documentation for debug_backtrace does not describe that it returns a reference. I am surprised that it is possible to change function parameters in the error handler, and I don't think it is supported behavior. Previous Comments: ------------------------------------------------------------------------ [2009-07-08 08:00:43] an0nym at narod dot ru Description: ------------ When argument of function or method is defined with type declaration and default value and is called with some value of this argument, debug_backtrace() doesn't reference this argument of function in stack. When function definition is the same except argument doesn't have default value, everything goes normal. Reproduce code: --------------- <?php function error($message,$number){ $traces=debug_backtrace(); $traces[1]['args'][0]='1'; return TRUE; } set_error_handler('error'); function a(anyUndefinedType $a){ // E_RECOVERABLE_ERROR var_dump($a===1,$a==='1'); } function b(anyUndefinedType $b=NULL){ // E_RECOVERABLE_ERROR var_dump($b===1,$b==='1'); } a(1); b(1); ?> Expected result: ---------------- bool(false) bool(true) bool(false) bool(true) Actual result: -------------- bool(false) bool(true) bool(true) bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48847&edit=1

« previous php.bugs (#141469) next »