Bug->Req #78219 [Opn]: Z_PARAM_BOOL should invoke cast_object
| From: | cmb@php.net | Date: | Mon, 27 Sep 2021 15:03:38 +0000 |
| Subject: | Bug->Req #78219 [Opn]: Z_PARAM_BOOL should invoke cast_object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236863@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78219&edit=1
ID: 78219
Updated by: cmb@php.net
Reported by: dwilks at intacct dot com
-Summary: Z_PARAM_BOOL doesn't invoke cast_object
+Summary: Z_PARAM_BOOL should invoke cast_object
Status: Open
-Type: Bug
+Type: Feature/Change Request
Package: Unknown/Other Function
Operating System: Any
PHP Version: 7.3.6
Block user comment: N
Private report: N
New Comment:
> Shouldn't an IS_OBJECT be given a chance at cast_object?
Maybe. But that is the same as with long and double. Anyhow,
this is not a bug, so changing to geature request.
Please submit a pull[1] request if you are still interested in
this.
> microtime returned null which it's not documented to do.
It is[2].
[1] <https://github.com/php/php-src/pulls>
[2] <https://www.php.net/manual/en/functions.internal.php>
Previous Comments:
------------------------------------------------------------------------
[2019-06-26 20:12:50] dwilks at intacct dot com
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 this bug report at https://bugs.php.net/bug.php?id=78219&edit=1