Skip to content

Assertion failure in ext/ffi/ffi.c #16620

@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?php
class Box {
}
class Test {
function __destruct() {
global $box;var_dump($box);
}
}
function test($box) {
$tmp = new Test;var_dump($tmp);
}
$box = new Box();var_dump($box);
$box->value = new Test;var_dump($box);
test($box);var_dump($box);
$zend = FFI::cdef("
typedef size_t (*zend_write_func_t)(const char *str, size_t str_length);
extern zend_write_func_t zend_write;
");
$orig_zend_write = clone $zend->zend_write;var_dump($orig_zend_write);
$zend->zend_write = function($str, $len) {
global $orig_zend_write;var_dump($orig_zend_write);
};
echo "Hello World!\n";

Resulted in this output:

object(Box)#1 (1) {
  ["value"php: /home/phpfuzz/WorkSpace/diffphp/php-src/ext/ffi/ffi.c:2127: HashTable *zend_ffi_cdata_get_debug_info(zend_object *, int *): Assertion `0' failed.
Aborted (core dumped)

and in JIT 1215:

object(Box)#1 (1) {
  ["value"NULL                         // (broken output)
  object(Test)#2 (0) {
  }
}

PHP Version

nightly

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions