Bug #80721 [NEW]: class_exists produce PHP Fatal error

From: Date: Sun, 07 Feb 2021 11:00:00 +0000
Subject: Bug #80721 [NEW]: class_exists produce PHP Fatal error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231976@lists.php.net to get a copy of this message
From:             parviz at engineer dot com
Operating system: Windows 10 Pro 64 Bit
PHP version:      7.4Git-2021-02-07 (Git)
Package:          *General Issues
Bug Type:         Bug
Bug description:class_exists produce PHP Fatal error

Description:
------------
when we declare a variable in a class that and initialize it like in
'Test script', and than use class_exists with that class name, it will
produce PHP Fatal error

Test script:
---------------
<?php

class TestClass {
	public object $testVar = (object) [
		'status' => false
	];
}

var_dump( class_exists('TestClass') );

Expected result:
----------------
return bool that tell us the class exists or not

Actual result:
--------------
Fatal error: Constant expression contains invalid operations in
D:\XAMPP\htdocs\test.php on line 4

-- 
Edit bug report at https://bugs.php.net/bug.php?id=80721&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80721&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80721&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80721&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80721&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80721&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80721&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80721&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80721&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80721&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80721&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80721&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80721&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80721&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80721&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80721&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80721&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80721&r=mysqlcfg


Thread (5 messages)

« previous php.bugs (#231976) next »