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

Invocation context seems not to be properly passed when invoking traced functions #224

Closed
labbati opened this issue Jan 8, 2019 · 2 comments · Fixed by #303
Closed

Invocation context seems not to be properly passed when invoking traced functions #224

labbati opened this issue Jan 8, 2019 · 2 comments · Fixed by #303
Assignees
Labels
🐛 bug Something isn't working c-extension Apply this label to issues and prs related to the C-extension

Comments

@labbati
Copy link
Member

labbati commented Jan 8, 2019

Tested in the php 7.2 test runner. This is probably a different version of #149

Invocation context seems not to be properly passed when invoking traced functions.

class A
{
    private function private_method()
    {
    }

    public function public_method()
    {
        spl_autoload_register(__CLASS__.'::private_method');
    }
}

dd_trace('spl_autoload_register', function () {
    return call_user_func_array('spl_autoload_register', func_get_args());
});

$a = new A();
$a->public_method();

$n = new \Not\Exist();

Results in

Fatal error: Uncaught LogicException: Function 'A::private_method' not callable (cannot access private method A::private_method()) in /home/circleci/app/playground.php on line 16

LogicException: Function 'A::private_method' not callable (cannot access private method A::private_method()) in /home/circleci/app/playground.php on line 16

Call Stack:
    0.0010     393032   1. {main}() /home/circleci/app/playground.php:0
    0.0010     393752   2. A->public_method() /home/circleci/app/playground.php:20
    0.0010     394072   3. {closure:/home/circleci/app/playground.php:15-17}() /home/circleci/app/playground.php:11
    0.0011     394072   4. spl_autoload_register() /home/circleci/app/playground.php:16

While the expected output is

Fatal error: Uncaught Error: Class 'Not\Exist' not found in /home/circleci/app/playground.php on line 22

Error: Class 'Not\Exist' not found in /home/circleci/app/playground.php on line 22

Call Stack:
    0.0009     393032   1. {main}() /home/circleci/app/playground.php:0
@labbati labbati added 🐛 bug Something isn't working c-extension Apply this label to issues and prs related to the C-extension labels Jan 8, 2019
@labbati labbati added this to the 0.10.0 milestone Jan 8, 2019
@labbati labbati modified the milestones: 0.10.0, 0.11.0 Jan 21, 2019
@labbati labbati removed this from the 0.12.0 milestone Feb 4, 2019
@SammyK
Copy link
Contributor

SammyK commented Apr 26, 2019

Just making a note that this issue will be resolved with #284 & #303. :)

@SammyK SammyK reopened this Apr 29, 2019
@SammyK SammyK closed this as completed Apr 29, 2019
@SammyK SammyK reopened this Apr 29, 2019
@SammyK
Copy link
Contributor

SammyK commented May 1, 2019

This should be fixed with release 0.21.0. :)

@SammyK SammyK closed this as completed May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working c-extension Apply this label to issues and prs related to the C-extension
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants