Skip to content

Adding an int to an empty string held in a mixed value returns the int instead of throwing TypeError. #147

Closed

Description

@blacktrs

Summary

Adding an int to an empty string held in a mixed value returns the int instead of throwing TypeError.

Repro

<?php
function g(mixed $a, mixed $b): mixed { return $a + $b; }
try { var_dump(g("", 1)); } catch (TypeError $e) { echo get_class($e), ": ", $e->getMessage(), "\n"; }

Expected (php)

TypeError: Unsupported operand types: string + int

Actual (manticore a73f81f6, Darwin arm64)

int(1)

Tracking

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

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

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions