Skip to content

Segmentation fault (access null pointer) in ext/spl/spl_array.c #15833

Closed
@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?php
class C {
public int $a;
}
$reflector = new ReflectionClass(C::class);
$obj = $reflector->newLazyProxy(function ($obj) {
$obj = new C();
return $obj;
});
$fusion = $obj;
$recursiveArrayIterator = new RecursiveArrayIterator($fusion);
$test = new RecursiveIteratorIterator($recursiveArrayIterator);
var_dump($test->current());

Resulted in this output:

/php-src/ext/spl/spl_array.c:79:7: runtime error: member access within null pointer of type 'HashTable' (aka 'struct _zend_array')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/spl/spl_array.c:79:7

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions