Skip to content

Regression with Segmentation fault when using Carbon #4855

@kleinmann

Description

@kleinmann

Bug report

Seems like PHPStan 0.12.83 has a regression of #2584 with Carbon 2.46.0.

Code snippet that reproduces the problem

Same example as in #2584:

<?php
use Carbon\Carbon;

require_once 'vendor/autoload.php';

$date = Carbon::parse(date(DATE_ATOM));
echo print_r($date);

Not possible on phpstan.org due to the dependency.

Expected output

No segmentation fault :-)

Additional information

A quick analysis in gdb yielded a backtrace that looked like some infinite recursion:

Details
0x00000001007fd102 in zend_eval_const_expr ()
... about 9.000 lines of the same ...
#9025 0x00000001007fd27f in zend_eval_const_expr ()
#9026 0x00000001007fb61c in zend_try_ct_eval_array ()
#9027 0x00000001007fb110 in zend_compile_array ()
#9028 0x00000001007e1d20 in zend_compile_expr ()
#9029 0x00000001007e4b78 in zend_compile_args ()
#9030 0x00000001007e51c5 in zend_compile_call_common ()
#9031 0x00000001007ea587 in zend_compile_static_call ()
#9032 0x00000001007e3a36 in zend_compile_var ()
#9033 0x00000001007e1b45 in zend_compile_expr ()
#9034 0x00000001007ec862 in zend_compile_return ()
#9035 0x00000001007edd6f in zend_compile_stmt ()
#9036 0x00000001007f8405 in zend_compile_top_stmt ()
#9037 0x00000001007f8357 in zend_compile_top_stmt ()
#9038 0x00000001007a08e6 in zend_compile ()
#9039 0x00000001007a077a in compile_file ()
#9040 0x00000001003c6ce4 in phar_compile_file ()
#9041 0x00000001007a0b2f in compile_filename ()
#9042 0x0000000100a284dd in zend_include_or_eval ()
#9043 0x000000010098d686 in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER ()
#9044 0x00000001008ea0b4 in execute_ex ()
#9045 0x00000001008ea753 in zend_execute ()
#9046 0x0000000100834072 in zend_execute_scripts ()
#9047 0x00000001007506cb in php_execute_script ()
#9048 0x0000000100a3cb9c in do_cli ()
#9049 0x0000000100a3b9d5 in main ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions