[php-src] Issue #10368: Arrow function should capture used variables only

From: Date: Wed, 18 Jan 2023 14:44:26 +0000
Subject: [php-src] Issue #10368: Arrow function should capture used variables only
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243486@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10368 Author: mvorisek ### Description ``` class O { function __destruct() { echo "D\n"; } } $o = new O(); $fx = fn() => ($o = 5) && $o; unset($o); var_dump($fx()); $o = new O(); $fx = fn($o) => $o; unset($o); var_dump($fx(5)); ``` https://3v4l.org/It1HL It currently outputs: ``` bool(true) D D int(5) ``` but I expect this output: ``` D bool(true) D int(5) ```

« previous php.bugs (#243486) next »