Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging bar not showing in PHP >= 5.4.4 (error in info.panel.phtml) #317

Closed
Sharasuke opened this issue Sep 20, 2018 · 4 comments
Closed

Debugging bar not showing in PHP >= 5.4.4 (error in info.panel.phtml) #317

Sharasuke opened this issue Sep 20, 2018 · 4 comments

Comments

@Sharasuke
Copy link

@Sharasuke Sharasuke commented Sep 20, 2018

Version: 2.5.2

Bug Description

While getting it to work/debugging via xdebug in PHP5.4.45 I came across an error message:
message:"syntax error, unexpected '&'"
file:"/var/www/vhosts/.../httpdocs/vendor/tracy/tracy/src/Tracy/assets/Bar/info.panel.phtml"
line:53

This is in the require statement of the panel in DefaultBarPanel.php on line: 50
While setting a breakpoint in the anonymous function in ob_start you can see the error if you run error_get_last() in the debug console.

More info: https://secure.php.net/manual/en/control-structures.foreach.php
"Before PHP 5.5.0, referencing $value is only possible if the iterated array can be referenced (i.e. if it is a variable). The following code works only as of PHP 5.5.0: "
But the required php version is still >=5.4.4 as seen in packagist.

Steps To Reproduce

Running: composer require tracy/tracy in a PHP 5.4.45 environment

Expected Behavior

Debug bar should show up

Possible Solution

Transforming
foreach ([&$packages, &$devPackages] as &$items) {
into
foreach ([&$packages, &$devPackages] as $items) {

Or making it work in 5.4 and 5.5
Or changing required PHP version

@milo

This comment has been minimized.

Copy link
Member

@milo milo commented Sep 20, 2018

Which Tracy version? Master branch targets PHP 7.1, the 2.5.2 is PHP 5.4 compatible.

@Sharasuke

This comment has been minimized.

Copy link
Author

@Sharasuke Sharasuke commented Sep 20, 2018

Tracy version 2.5.2.
According to the php manual page I referenced:
src/Tracy/assets/Bar/info.panel.phtml:53 is not compatible with PHP version < 5.5.0

@milo

This comment has been minimized.

Copy link
Member

@milo milo commented Sep 20, 2018

I see. Caused by d1ec8a2. Probably fixable by:

$tmp = [&$packages, &$devPackages];
foreach ($tmp as &$items) {...}
dg added a commit that referenced this issue Sep 20, 2018
dg added a commit that referenced this issue Sep 20, 2018
@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Sep 20, 2018

Fixed, thanks

@dg dg closed this Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.