Bug #27348

Incompatible call to debug_backtrace() prior to PHP 5.3.5

Added by Schmidt Timo almost 9 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
Start date:
2011-06-10
Due date:
% Done:

100%

TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

debug-backtrace.patch View (939 Bytes) Schmidt Timo, 2011-06-10 12:59

issue_27348.patch View (1.23 KB) Patrick Schriner, 2011-06-20 10:28


Related issues

Duplicated by TYPO3 Core - Bug #27196: debug_backtrace in getOuterMostInstance Closed 2011-06-03
Duplicated by TYPO3 Core - Bug #27584: Various warnings in log when running scheduler Rejected 2011-06-20

Associated revisions

Revision db8f0c16 (diff)
Added by Oliver Hader almost 9 years ago

[BUGFIX] Incompatible call to debug_backtrace() prior to PHP 5.3.5

The additional parameter to debug_backtrace() was introduced
with PHP 5.3.6. To stay compatible with PHP 5.3.0, it shall be
removed again - besides that the behaviour stays the same.

Change-Id: Icab51963bae4e5f72c14404828cd3c9b9231796f
Resolves: #27348
Releases: 4.6, 4.5
Reviewed-on: http://review.typo3.org/2836
Reviewed-by: Markus Klein
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

Revision 52e1c1ee (diff)
Added by Oliver Hader almost 9 years ago

[BUGFIX] Incompatible call to debug_backtrace() prior to PHP 5.3.5

The additional parameter to debug_backtrace() was introduced
with PHP 5.3.6. To stay compatible with PHP 5.3.0, it shall be
removed again - besides that the behaviour stays the same.

Change-Id: Iaca7308c7eaadc7f47bf4927cc25924aa0640835
Resolves: #27348
Releases: 4.6, 4.5
Reviewed-on: http://review.typo3.org/2837
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

History

#1 Updated by Schmidt Timo almost 9 years ago

short test script:

class Foo {

        public function sayHello() {

                var_dump(debug_backtrace());

        }
}

$foo = new Foo();
$foo->sayHello();

#2 Updated by Xavier Perseguers almost 9 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

#3 Updated by Oliver Hader almost 9 years ago

  • Assignee set to Oliver Hader
  • Target version set to 4.5.4

#4 Updated by Patrick Schriner almost 9 years ago

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.

#5 Updated by Oliver Hader almost 9 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

#6 Updated by Oliver Hader almost 9 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

#7 Updated by Mr. Hudson almost 9 years ago

Patch set 1 of change Icab51963bae4e5f72c14404828cd3c9b9231796f has been pushed to the review server.
It is available at http://review.typo3.org/2836

#8 Updated by Mr. Hudson almost 9 years ago

Patch set 1 of change Iaca7308c7eaadc7f47bf4927cc25924aa0640835 has been pushed to the review server.
It is available at http://review.typo3.org/2837

#9 Updated by Oliver Hader almost 9 years ago

  • Status changed from New to Under Review
  • PHP Version set to 5.3

#10 Updated by Oliver Hader almost 9 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...

#11 Updated by Oliver Hader almost 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#12 Updated by Riccardo De Contardi over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF