Bug #80836 [Opn->Csd]: is_array defies it own purpose by throwing fatal when passed an stdClass

From: Date: Fri, 05 Mar 2021 21:20:44 +0000
Subject: Bug #80836 [Opn->Csd]: is_array defies it own purpose by throwing fatal when passed an stdClass
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232583@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80836&edit=1 ID: 80836 User updated by: chris at summit-tech dot ca Reported by: chris at summit-tech dot ca Summary: is_array defies it own purpose by throwing fatal when passed an stdClass -Status: Open +Status: Closed Type: Bug Package: Compile Failure Operating System: Windows PHP Version: 8.0.3 Block user comment: N Private report: N New Comment: Incorrectly described, closing Previous Comments: ------------------------------------------------------------------------ [2021-03-05 21:14:28] chris at summit-tech dot ca Description: ------------ This function has been rendered utterly useless as passing it some non-array objects such as stdClass results in a ridiculous error: Fatal error: Uncaught Error: Cannot use object of type stdClass as array Test script: --------------- $test->bla = "bla"; //Forcibly makes an stdClass obj if (is_array($test)){ echo "This doesn't run"; } Expected result: ---------------- is_array should return false and not stupidly throw a fatal Actual result: -------------- fatal error that defies the purpose of this function's entire existence ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80836&edit=1

« previous php.bugs (#232583) next »