Skip to content

FFI::new interacts badly with observers #12905

Closed
@derickr

Description

@derickr

Description

If you compile PHP with:

./configure --enable-debug --disable-all --enable-zend-test --with-ffi
make clean && make

And then run:

sapi/cli/php -n  -dzend_test.observer.enabled=1 -dzend_test.observer.observe_all=1 /tmp/ffi-test.php

Where /tmp/ffi-test.php is:

<?php
$ffi = FFI::cdef("", "libc.so.6");
$ffi->new("int");

Resulted in this output:

…
Fatal error: Uncaught FFI\ParserException: unexpected '<EOF>' at line 1 in /tmp/ffi.php:3
Stack trace:
#0 /tmp/ffi.php(3): FFI->new('')
#1 {main}
  thrown in /tmp/ffi.php on line 3

But I expected it to not have an exception.

Without the observer enabled, this also does not show an exception.

Originally reported in https://bugs.xdebug.org/2224

PHP Version

PHP 8.3.2-dev

Operating System

Debian Trixie/sid

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions