Skip to content

JIT: misaligned zval passed to ZEND_ADD_ARRAY_ELEMENT handler #25269

Closed

Description

@YuanchengJiang

Description

The following code:

<?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

nightly

Operating System

No response

Activity

  1. self-assigned this
    on Nov 7, 2026
  2. added 2 commits that reference this issue on Nov 7, 2026
    038931d
    9a16899
  3. added a commit that references this issue on Nov 7, 2026
    b1fea43
  4. added a commit that references this issue on Nov 8, 2026
    0b8612d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions