Open
Description
Description
The following code:
<?php
$obj = (new ReflectionClass( "SplFileObject" ))->newInstanceWithoutConstructor();
(new ReflectionMethod( "SplFileObject", "fputcsv" ))->invoke( $obj, [] );
echo "Done\n";
Resulted in this output:
[seg fault]
But I expected this output instead:
Done
See https://3v4l.org/uqjqf for confirmation.
Valgrind locally for 8.4 reports
==9459== Invalid read of size 8
==9459== at 0x7939BD: _php_stream_write (streams.c:1297)
==9459== by 0x6A1A6E: php_fputcsv (file.c:1795)
==9459== by 0x61B03F: zim_SplFileObject_fputcsv (spl_directory.c:2369)
==9459== by 0x87719D: zend_call_function (zend_execute_API.c:1009)
==9459== by 0x87757D: zend_call_known_function (zend_execute_API.c:1090)
==9459== by 0x5D6433: reflection_method_invoke (php_reflection.c:3483)
==9459== by 0x5D6575: zim_ReflectionMethod_invoke (php_reflection.c:3501)
==9459== by 0x88E5E3: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:1919)
==9459== by 0x909846: execute_ex (zend_vm_execute.h:58830)
==9459== by 0x90E0F8: zend_execute (zend_vm_execute.h:64217)
==9459== by 0x9A4C45: zend_execute_script (zend.c:1928)
==9459== by 0x76EEF7: php_execute_script_ex (main.c:2574)
PHP Version
PHP 8.2+
Operating System
No response