[php-src] Issue #14073: Scalar Type Casting Magic Methods
| From: | kripper | Date: | Mon, 29 Apr 2024 04:33:07 +0000 |
| Subject: | [php-src] Issue #14073: Scalar Type Casting Magic Methods | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246832@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14073
Author: kripper
### Description
When doing
$obj + 123, $obj shouldn't be treated by PHP as a string
when $obj is a numeric representation.
Adding the magic casting method __toscalar is handy for solving this.
Please release [this patch](https://gist.github.com/ircmaxell/1966809).
See: https://wiki.php.net/rfc/object_cast_to_types