|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #78219 Z_PARAM_BOOL should invoke cast_object
Submitted: 2019-06-26 20:12 UTC Modified: 2021-09-27 15:03 UTC
From: dwilks at intacct dot com Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 7.3.6 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: dwilks at intacct dot com
New email:
PHP Version: OS:


 [2019-06-26 20:12 UTC] dwilks at intacct dot com
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:
// Replace IaNumber with any PHP Extension class that can cast_object to _IS_BOOL
$n = new IaNumber("0");
$a = microtime($n);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-27 15:03 UTC]
-Summary: Z_PARAM_BOOL doesn't invoke cast_object +Summary: Z_PARAM_BOOL should invoke cast_object -Type: Bug +Type: Feature/Change Request
 [2021-09-27 15:03 UTC]
> 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

> microtime returned null which it's not documented to do.

It is[2].

[1] <>
[2] <>
 [2021-09-27 15:03 UTC]
-Package: Unknown/Other Function +Package: Scripting Engine problem
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 20:01:29 2024 UTC