php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78219 Z_PARAM_BOOL doesn't invoke cast_object
Submitted: 2019-06-26 20:12 UTC Modified: -
From: dwilks at intacct dot com Assigned:
Status: Open Package: Unknown/Other Function
PHP Version: 7.3.6 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
29 - 25 = ?
Subscribe to this entry?

 
 [2019-06-26 20:12 UTC] 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);



Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Nov 25 20:01:23 2020 UTC