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

Arguments not populated. #11

Closed
alanhatch opened this issue Apr 9, 2019 · 6 comments
Closed

Arguments not populated. #11

alanhatch opened this issue Apr 9, 2019 · 6 comments

Comments

@alanhatch
Copy link

alanhatch commented Apr 9, 2019

I'm not seeing the $arguments variable being populated. The issue is with the setBreakpoint method in the BreakpointExtension class in src/BreakpointExtension.php.

It works if I replace this:
$arguments = array_slice($ func_get_args(), 2);
with
$arguments = func_get_args();
$arguments = array_slice($arguments, 2);

@ajgarlag
Copy link
Owner

ajgarlag commented Apr 9, 2019

Can you open a PR?

@alanhatch
Copy link
Author

Hopefully that's okay.

@ajgarlag
Copy link
Owner

ajgarlag commented Apr 10, 2019

Thanks for your submission, but I cannot reproduce your issue. I've coded a quick POC in https://3v4l.org/270Fa and I see no difference with your proposed implementation in #12 .

What IDE are you using to debug the template? Can you post two images to illustrate the problem with the debugger, before and after your proposed change?

@alanhatch
Copy link
Author

alanhatch commented Apr 10, 2019

Here is my setup and version info:

  • IDE: Phpstorm 2019.1 Build #PS-191.6183.95
  • Project: Drupal 8 with twig_xdebug module
  • Environment: Docksal Apache
  • PHP: 7.1.22
  • Xdebug: 2.6.1

There has been an issue raised on Drupal.org regarding $arguments not being populated. The issue also mentions issues with non-population of other array elements in $context but I cannot reproduce that. Link to the issue: https://www.drupal.org/project/twig_xdebug/issues/2973341

Out of the box and adding {{ breakpoint("Test") }} to a template, I see:
Selection_023

With the proposed change and adding {{ breakpoint("Test") }} to a template, I see:
Selection_024

If I set an intermediate variable ($func_get_args_output = func_get_args();) rather than overwriting the $arguments variable, I see this:
Selection_025

When func_get_args() is used directly as an argument for the array_slice function, $arguments doesn't show in the variables list. I was wondering if it was a PHP version issue but your POC seems to have that covered. I've also tested with PHP 7.2.10 and Xdebug 2.7.0beta1 with the same result.

@ajgarlag
Copy link
Owner

Thanks for the detailed info. I've been able to reproduce the issue with:

  • IDE: Apache NetBeans 11.0
  • Project: Symfony 2.8
  • Environment: Apache 2.4 with PHP-FPM
  • PHP: 7.2.16
  • Xdebug: 2.6.1

I'm not sure where is the issue originated, but I'll approve the PR to solve it

@charginghawk
Copy link
Contributor

Thanks for the quick turnaround all! This will be released on the Drupal side shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants