[php-src] Issue #12905: FFI::new interacts badly with observers

From: Date: Fri, 08 Dec 2023 16:23:40 +0000
Subject: [php-src] Issue #12905: FFI::new interacts badly with observers
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246013@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12905
Author: 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
<?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


Thread (1 message)

  • derickr
« previous php.bugs (#246013) next »