Skip to content

opcache: NULL zend_class_mutable_data in zend_class_default_properties_table (ArrayObject::getIterator) #25585

Open

Description

@YuanchengJiang

Description

The following code:

<?php
const VALUE = true;
class MyIterator extends ArrayIterator {
    public $var = VALUE;
}
$ao = new ArrayObject(["a" => 1], 0, "MyIterator");
foreach ($ao as $v) {}

Resulted in this output:

Zend/zend_API.h:441:24: runtime error: member access within null pointer of type 'const zend_class_mutable_data' (aka 'const struct _zend_class_mutable_data')
    #0 0x5c82ff6 in zend_class_default_properties_table Zend/zend_API.h:441:24
    #1 0x5c0f0f3 in _object_properties_init Zend/zend_API.c:1692:15
    #2 0x5c0f017 in object_properties_init Zend/zend_API.c:1719:2
    #3 0x41dbb06 in spl_array_object_new_ex ext/spl/spl_array.c:159:2
    #4 0x41db6ed in zim_ArrayObject_getIterator ext/spl/spl_array.c:1106:2
    #5 0x5f5342f in zend_call_function Zend/zend_execute_API.c:1092:4
    #6 0x5f590dd in zend_call_known_function_ex Zend/zend_execute_API.c:1185:23
    #7 0x68864d3 in zend_call_known_function Zend/zend_API.h:895:2
    #8 0x6898a94 in zend_call_known_instance_method Zend/zend_API.h:923:2
    #9 0x688672b in zend_call_known_instance_method_with_0_params Zend/zend_API.h:929:2
    #10 0x68866ef in zend_user_it_new_iterator Zend/zend_interfaces.c:92:2
    #11 0x688a5fc in zend_user_it_get_new_iterator Zend/zend_interfaces.c:241:2
    #12 0x662fded in zend_fe_reset_iterator Zend/zend_execute.c:5448:31
    #13 0x628b801 in ZEND_FE_RESET_R_SPEC_CV_HANDLER Zend/zend_vm_execute.h:40529:20
    ...

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Zend/zend_API.h:441:24 in 

To reproduce: ./sapi/cli/php -d opcache.enable_cli=1 -d opcache.file_update_protection=0 test.php

Commit:

19d3b9303017d02501f0fe59ba4438b25ee28477

Configurations:

CC="clang-12" CXX="clang++-12" CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE" CXXFLAGS="-DZEND_VERIFY_TYPE_INFERENCE" ./configure --enable-debug --enable-address-sanitizer --enable-undefined-sanitizer --enable-re2c-cgoto --enable-zts --enable-bcmath --enable-calendar --enable-dba --enable-dl-test --enable-exif --enable-ftp --enable-gd --enable-gd-jis-conv --enable-mbstring --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-zend-test --with-zlib --with-bz2 --with-curl --with-enchant --with-gettext --with-gmp --with-mhash --with-ldap --with-libedit --with-readline --with-snmp --with-sodium --with-xsl --with-zip --with-mysqli --with-pdo-mysql --with-pdo-pgsql --with-pgsql --with-sqlite3 --with-pdo-sqlite --with-webp --with-jpeg --with-freetype --enable-sigchild --with-pcre-jit --with-iconv

Operating System:

Ubuntu 20.04 Host, Docker 0599jiangyc/flowfusion:latest

This report is automatically generated by FlowFusion

PHP Version

nightly

Operating System

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions