php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81021 Seg fault while calling closure from Reflection
Submitted: 2021-05-08 12:14 UTC Modified: 2021-05-08 20:19 UTC
From: lukin dot andrej at gmail dot com Assigned:
Status: Not a bug Package: Reflection related
PHP Version: 8.0.6 OS: Mac OS 11.3.1
Private report: No CVE-ID: None
 [2021-05-08 12:14 UTC] lukin dot andrej at gmail dot com
Description:
------------
I'm receiving a seg. fault running the code below.
The backtrace is not much informative for this call.

(gdb) bt
#0  0x00007fff207a5552 in ?? ()
#1  0x00007ffeefbfe530 in ?? ()
#2  0x00000001002b8d5c in ?? ()
#3  0x00007ffeefbfdc80 in ?? ()
#4  0x00007fff204d6797 in ?? ()
#5  0x000000000000002e in ?? ()
#6  0x0000000105f4ba50 in ?? ()
#7  0x0000000000000019 in ?? ()
#8  0x0000000105805680 in ?? ()
#9  0x0000000105f4ba50 in ?? ()
#10 0x0000000000000000 in ?? ()

Test script:
---------------
class Test
{
    private string $name;

    public function __construct(string $name)
    {
        $this->name = $name;
    }
}

$class = new ReflectionClass(Test::class);
$instance = \Closure::fromCallable([$class, 'newInstanceWithoutConstructor']);
$instance();

Actual result:
--------------
(gdb) bt
#0  0x00007fff207a5552 in ?? ()
#1  0x00007ffeefbfe530 in ?? ()
#2  0x00000001002b8d5c in ?? ()
#3  0x00007ffeefbfdc80 in ?? ()
#4  0x00007fff204d6797 in ?? ()
#5  0x000000000000002e in ?? ()
#6  0x0000000105f4ba50 in ?? ()
#7  0x0000000000000019 in ?? ()
#8  0x0000000105805680 in ?? ()
#9  0x0000000105f4ba50 in ?? ()
#10 0x0000000000000000 in ?? ()

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-05-08 12:27 UTC] lukin dot andrej at gmail dot com
It's happening only when xdebug extension is enabled
zend_extension="xdebug.so"
 [2021-05-08 12:29 UTC] lukin dot andrej at gmail dot com
Reinstalling xdebug helped
 [2021-05-08 12:29 UTC] lukin dot andrej at gmail dot com
-Status: Open +Status: Closed
 [2021-05-08 12:29 UTC] lukin dot andrej at gmail dot com
Reinstalling xdebug helped
 [2021-05-08 20:19 UTC] requinix@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Jul 26 01:01:23 2021 UTC