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

Using php's 8.1 first class callable method leaves an xdebug in limbo #85

Closed
tschallacka opened this issue Mar 29, 2024 · 1 comment
Closed
Assignees

Comments

@tschallacka
Copy link

Serializable Closure Version

1.3.3

PHP Version

8.1.19

Description

When a closure is passed via a first class callable method xdebug doesn't know where it is.

image

When a closure is passed via a first class callable method, maybe serialize the given class, then call the method on the deserialized class?
Currently we need to use string references instead of these first class callable features we have now available.

Steps To Reproduce

<?php
namespace Foo;
include_once '/path/to/laravel/vendor/autoload.php';

use Laravel\SerializableClosure\SerializableClosure;

class Bar {
    public function __construct(public int $x = 0) {

    }

    public function foo(int $a) {
        $y = $a + $this->x;
        xdebug_break();
    }
}

$bar = new Bar();
$closure = new SerializableClosure($bar->foo(...));
$x = serialize($closure);
echo $x;
$z = unserialize($x);
$z->getClosure()(2);
@driesvints
Copy link
Member

Heya. We don't believe this library is responsible for making sure something like xdebug_break works when serialising closures. If you could solve this one in a clean manner we could maybe consider a PR. Thanks.

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

No branches or pull requests

3 participants