|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #48847 debug_backtrace() doesn't reference arguments in stack in some cases
Submitted: 2009-07-08 08:00 UTC Modified: 2013-02-17 10:29 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: an0nym at narod dot ru Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.10, 5.3.0 OS: *
Private report: No CVE-ID: None
 [2009-07-08 08:00 UTC] an0nym at narod dot ru
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){
	return TRUE;
function a(anyUndefinedType $a){ // E_RECOVERABLE_ERROR
function b(anyUndefinedType $b=NULL){ // E_RECOVERABLE_ERROR
b(1); ?>

Expected result:
bool(false) bool(true)
bool(false) bool(true)

Actual result:
bool(false) bool(true)
bool(true) bool(false)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-25 07:21 UTC]
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.
 [2009-08-25 09:04 UTC] an0nym at narod dot ru
I agree that manual doesn't document anything related to this issue - according to manual behaviour in this particular case is undefined, so 
de jure this is not a bug. 

However, I think behaviour should be at least equal in both cases I 
provided. Moreover, I don't see the point of triggering recoverable 
error when you can't influence the cause of it. 

> I am surprised that it is possible to change function
parameters in the error handler, and I don't think it is supported
I think it is OK to change function parameters in the error handler for 
catchable error which these function parameters were reason for. Maybe 
debug_backtrace() is not the appropriate tool to get there parameters, 
but there is no other.
 [2010-12-20 13:19 UTC]
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2013-02-17 10:29 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Modifying debug traces is definitely not a supported functionality.
 [2013-02-17 10:29 UTC]
-Status: Open +Status: Not a bug
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 15:01:32 2024 UTC