Bug #27348
closedIncompatible call to debug_backtrace() prior to PHP 5.3.5
100%
Description
There is a bug in TYPO3 4.5.3 with old php versions. The method getOuterMostInstance() calls debug_backtrace with the parameter TRUE. This parameter was introduced with Version 5.2.5 the default value is true. The idea of this argument it to prevent the output of the object in the trace by settings the value to FALSE. Therefore it should be possible to call debug_backtrace() without any parameter which works with php version 5.2 and 5.3.
var_dump(debug_backtrace(TRUE));
?>
php --version
PHP 5.3.6 with Suhosin-Patch (cli) (built: Apr 7 2011 11:53:13)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with the ionCube PHP Loader v4.0.8, Copyright (c) 2002-2011, by ionCube Ltd., and
with Xdebug v2.1.1, Copyright (c) 2002-2011, by Derick Rethans
Output:
array(0) {
}
php --version
PHP 5.2.4-2ubuntu5.14 with Suhosin-Patch 0.9.6.2 (cli) (built: Jan 12 2011 15:54:52)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
Output:
PHP Warning: Wrong parameter count for debug_backtrace() in /home/tschmidt/test.php on line 3
Warning: Wrong parameter count for debug_backtrace() in /home/tschmidt/test.php on line 3
NULL
Files
Updated by Schmidt Timo about 13 years ago
short test script:
class Foo { public function sayHello() { var_dump(debug_backtrace()); } } $foo = new Foo(); $foo->sayHello();
Updated by Xavier Perseguers about 13 years ago
Hi,
Would you mind pushing it to Gerrit for review? I can already tell you that it does not respect CGL:
- a few assignments ($toto = ...) have the = sign aligned with tabs => single space before and after
- parentheses should be separated by a single space before
Updated by Oliver Hader about 13 years ago
- Assignee set to Oliver Hader
- Target version set to 4.5.4
Updated by Patrick Schriner about 13 years ago
- File issue_27348.patch issue_27348.patch added
Good that I looked for a ticket... This would be my patch proposal - a bit more like the original code sample. For PHP > 5.3.6 the additional if should be a performance improvement.
Updated by Oliver Hader about 13 years ago
- Subject changed from tcemain bug in php < 5.2.5 debug_backtrace to Incompatible call to debug_backtrace() prior to PHP 5.2.5
Updated by Oliver Hader about 13 years ago
- Subject changed from Incompatible call to debug_backtrace() prior to PHP 5.2.5 to Incompatible call to debug_backtrace() prior to PHP 5.3.5
Updated by Mr. Hudson about 13 years ago
Patch set 1 of change Icab51963bae4e5f72c14404828cd3c9b9231796f has been pushed to the review server.
It is available at http://review.typo3.org/2836
Updated by Mr. Hudson about 13 years ago
Patch set 1 of change Iaca7308c7eaadc7f47bf4927cc25924aa0640835 has been pushed to the review server.
It is available at http://review.typo3.org/2837
Updated by Oliver Hader about 13 years ago
- Status changed from New to Under Review
- PHP Version set to 5.3
Updated by Oliver Hader about 13 years ago
Thanks for the patch, however I used the simple approach to remove the additional argument.
I don't think it makes much sense to introduce switches for different PHP behaviours to specific part of the Core.
However, if it turns out to be a problem (concerning memory) we could think about a t3lib_utility_PhpCompatibility::debug_backtrace() so it can be used by other classes and methods as well...
Updated by Oliver Hader about 13 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset db8f0c164ba5cdd14d15b70df6344dc15685d432.
Updated by Riccardo De Contardi almost 7 years ago
- Status changed from Resolved to Closed