xref: /php-src/ext/ffi/tests/bug78761.phpt (revision 4acf0084)
1--TEST--
2Bug #78761 (Zend memory heap corruption with preload and casting)
3--EXTENSIONS--
4ffi
5posix
6--SKIPIF--
7<?php
8if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
9if (posix_geteuid() == 0) die('skip Cannot run test as root.');
10?>
11--INI--
12opcache.enable_cli=1
13opcache.preload={PWD}/bug78761_preload.php
14--FILE--
15<?php
16try {
17    FFI::cdef()->cast('char[10]', FFI::cdef()->new('char[1]'));
18} catch (FFI\Exception $ex) {
19    echo $ex->getMessage(), PHP_EOL;
20}
21?>
22--EXPECT--
23attempt to cast to larger type
24