Bug #79976 [NEW]: anonymous class instanceof error in cli
From: consatan at gmail dot com
Operating system: Linux
PHP version: 7.3.21
Package: *General Issues
Bug Type: Bug
Bug description:anonymous class instanceof error in cli
Description:
------------
test on docker php:(7.3.0~7.4.1)-cli-alpine
```
$ docker run --rm -ti php:7.3.21-cli-alpine sh
/ # php -a
Interactive shell
php > class A {}
php > class B {}
php > var_dump((new class() extends A {}) instanceof A);
bool(true)
php > var_dump((new class() extends B {}) instanceof B);
bool(false)
```
if running with a php file, it's work.
```
$ docker run --rm -ti php:7.3.21-cli-alpine sh
/ # cat <<EOF>>/tmp/test.php
> <?php
> class A {}
> class B {}
> var_dump((new class() extends A {}) instanceof A);
> var_dump((new class() extends B {}) instanceof B);
> EOF
/ # php -f /tmp/test.php
bool(true)
bool(true)
```
Test script:
---------------
class A {}
class B {}
var_dump((new class() extends A {}) instanceof A);
var_dump((new class() extends B {}) instanceof B);
Expected result:
----------------
bool(true)
bool(true)
Actual result:
--------------
bool(true)
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=79976&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79976&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79976&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79976&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79976&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79976&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79976&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79976&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79976&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79976&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79976&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79976&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79976&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79976&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79976&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79976&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79976&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79976&r=mysqlcfg
Thread (6 messages)
- consatan at gmail dot com