FUNCTION In Closure Changed
When using the magic constant __FUNCTION__ inside a closure, the content used to be the {closure} string only. Since PHP 8.4, it also includes the name of the original file, and the line number, so as to identify the origin source code.
PHP code
<?php
$foo = fn() => __FUNCTION__;
$closure = function() { return __FUNCTION__;};
echo $foo();
echo $closure();
?>
Before
{closure}{closure}
After
{closure:/codes/magicConstantInClosure.php:3}{closure:/codes/magicConstantInClosure.php:5}
PHP version change
This behavior changed in 8.4.