1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/ffi/tests/bug79075.phpt
Niels Dossche 612a34cbec Fix bug #79075: FFI header parser chokes on comments
The directives for FFI should be first in the file, which is fine,
however sometimes there can be comments or whitespace before or between
these defines. One practical example is for license information or when
a user adds newlines "by accident". In these cases, it's quite confusing
that the directives do not work properly.
To solve this, make the zend_ffi_parse_directives() aware of comments.

Closes GH-17082.
2024-12-09 22:29:02 +01:00

26 lines
519 B
PHP

--TEST--
Bug #79075 (FFI header parser chokes on comments)
--EXTENSIONS--
ffi
opcache
posix
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') die('skip not for Windows');
if (posix_geteuid() == 0) die('skip Cannot run test as root.');
?>
--INI--
ffi.enable=1
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.preload={PWD}/bug79075.inc
opcache.file_cache_only=0
--FILE--
<?php
$ffi = FFI::scope("bug79075");
$ffi->printf("Hello World from %s!\n", "PHP");
?>
--EXPECT--
Hello World from PHP!