Skip to content

A bare array param read as (float) $o[2] and (string) $o[1002] crashes (an int read as a string pointer) once a caller also passes []. #318

Closed

Description

@blacktrs

Summary

A bare array param read as (float) $o[2] and (string) $o[1002] crashes (an int read as a string pointer) once a caller also passes [].

Repro

<?php
function open(array $options): string {
    $t = isset($options[2]) ? (float) $options[2] : 30.0;
    $i = '';
    if (isset($options[1002])) { $i = (string) $options[1002]; }
    return $t . '|' . $i;
}
function call_open(?array $options = null): void { echo open($options === null ? [] : $options), "\n"; }
call_open([2 => 3]);
call_open();

Expected (php)

3|
30|

Actual (manticore 1dcd1de3, Darwin arm64)

(no output) [exit code 139 - SIGSEGV]

Found while writing the pdo_mysql driver (a connect-time $options array read as float and as string in one function).

Tracking

Known-bug repro: tests/aot/repro/crash/array_param_float_string_casts.php - bash tests/aot/xfail.sh -k array_param_float_string_casts reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    crash
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcrash

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions