[php-src] Issue #25269: JIT: misaligned zval passed to ZEND_ADD_ARRAY_ELEMENT handler
| From: | YuanchengJiang | Date: | Sat, 07 Nov 2026 09:15:40 +0000 |
| Subject: | [php-src] Issue #25269: JIT: misaligned zval passed to ZEND_ADD_ARRAY_ELEMENT handler | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-254051@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/25269
Author: YuanchengJiang
### Description
The following code:
```php
<?php
set_error_handler(function($errno, $errstr) {
throw new ErrorException($errstr);
});
class AzureAuthHelper {
public static function getAzureEnvironment($env) {
$validEnvs = [
null => 1, "" => 1, " " => 1, "azure" => 1,
"AZURE_CLOUD" => 1,
];
return $validEnvs[strtolower(trim($env))] ?? 1;
}
}
AzureAuthHelper::getAzureEnvironment("unknown");
```
Resulted in this output:
```
Zend/zend_vm_execute.h:7986:4: runtime error: member access within misaligned address 0x7feaa52b2539
for type 'zval' (aka 'struct _zval_struct'), which requires 8 byte alignment
0x7feaa52b2539: note: pointer points here
00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 10 00 00 00 00
^
#0 0x6229e71 in ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER Zend/zend_vm_execute.h:7986:4
#1 0x48812b5c (/dev/zero (deleted)+0x8000b5c)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Zend/zend_vm_execute.h:7986:4 in
```
To reproduce:
./sapi/cli/php -d opcache.enable_cli=1 -d opcache.jit=1235 -d
opcache.jit_buffer_size=64M -d opcache.file_update_protection=0 -d opcache.jit_hot_loop=1 -d
opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 test.php
### PHP Version
```plain
nightly
```
### Operating System
_No response_