Skip to content

[Bug] isset() and unset() reject PHP-valid multi-argument forms #196

@nahime0

Description

@nahime0

Description

PHP allows isset() and unset() to take multiple arguments, but elephc rejects both forms with an arity error.

This is a direct PHP compatibility issue.

Reproduction

isset()

<?php
$a = 1;
$b = null;
echo isset($a, $b) ? "yes\n" : "no\n";

PHP output

no

elephc behavior

Compilation fails with:

error[4:6]: isset() takes exactly 1 argument

unset()

<?php
$a = 1;
$b = 2;
unset($a, $b);
echo isset($a) ? "a\n" : "na\n";
echo isset($b) ? "b\n" : "nb\n";

PHP output

na
nb

elephc behavior

Compilation fails with:

error[4:1]: unset() takes exactly 1 argument

Expected behavior

Both programs should compile and behave like PHP:

  • isset($a, $b) should return true only if all operands are set and not null
  • unset($a, $b) should unset all listed variables

Actual behavior

elephc hard-rejects the PHP-valid multi-argument forms.

Environment

  • elephc 0.21.14
  • PHP 8.4.20
  • macOS ARM64

Notes

This likely lives in builtin signature / argument validation rather than runtime lowering.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingphp-compatibilityPHP compatibility / deviation from PHP behaviortype-checkerStatic type checker / inference issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions