Bug #78219 [NEW]: Z_PARAM_BOOL doesn't invoke cast_object

From: Date: Wed, 26 Jun 2019 20:12:50 +0000
Subject: Bug #78219 [NEW]: Z_PARAM_BOOL doesn't invoke cast_object
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221508@lists.php.net to get a copy of this message
From: dwilks at intacct dot com Operating system: Any PHP version: 7.3.6 Package: Unknown/Other Function Bug Type: Bug Bug description:Z_PARAM_BOOL doesn't invoke cast_object Description: ------------ I have an extension class that implements cast_object and is castable to IS_STRING, IS_LONG, IS_DOUBLE, _IS_BOOL, and _IS_NUMBER (Thanks nikic). I was just testing it out and tried to throw an instance of this class to microtime() and - the following warning was generated: "microtime() expects parameter 1 to be bool, object given" - microtime returned null which it's not documented to do. I traced the code path down to zend_parse_arg_bool_weak and noticed that it doesn't do anything for zend types > IS_STRING. Shouldn't an IS_OBJECT be given a chance at cast_object? Test script: --------------- <?php // Replace IaNumber with any PHP Extension class that can cast_object to _IS_BOOL $n = new IaNumber("0"); $a = microtime($n); -- Edit bug report at https://bugs.php.net/bug.php?id=78219&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78219&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78219&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78219&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=78219&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78219&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78219&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78219&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78219&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78219&r=support Expected behavior: https://bugs.php.net/fix.php?id=78219&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78219&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78219&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78219&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78219&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=78219&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78219&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78219&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78219&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78219&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78219&r=mysqlcfg

« previous php.bugs (#221508) next »