Comments (4)
Hi!
bcadd only accepts string as $left or $right https://www.php.net/manual/en/function.bcadd.php in your example you don't use
declare(strict_types=1); so php just casts null to string thats why it's working. Lib use strict types.
I don't want to jiggle types and handle null. You can fork this and remove "declare(strict_types=1)" from lib this should have the same behavior.
https://phpsandbox.io/n/patient-disk-ekez-sxkgs
from bcmath-extended.
Its makes no sense to support NULL for any of those relevant functions. Don't call the method if the value is null.
from bcmath-extended.
Then I guess if that's how you feel about it, that's how it'll be. I'll keep the fork, as I do need to have that null accepted and handled like it did on PHP 7.x.
PS : https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
from bcmath-extended.
Did you take a look at my PR ? I would much rather not have to maintain a separate package, especially for such a change that doesn't seem so extreme in philosophy.
But in the meantime, I've created a fork like you suggested, so here it is : https://packagist.org/packages/gammadia/bcmath-extended-nullable
from bcmath-extended.
Related Issues (20)
- Request for RoundDown/RoundUp with precision HOT 2
- Adding Support for sci-float HOT 2
- Scale not applied
- Scientific notation regex HOT 1
- Idea: this project should add the existed bc methods HOT 2
- bcmod 7.2 issue HOT 4
- Make getDecimalsLengthFromNumber() public HOT 2
- BC::pow only supports integer exponents HOT 2
- Looks like roundUp doesn't work as expected HOT 6
- Add operator method features HOT 1
- Support array param for BC:max and BC:min HOT 2
- Consistent type hints HOT 2
- Consider dropping support for php5 and php7.0 HOT 2
- Invalid result for BC::pow with negative fractional exponent HOT 6
- Why is the trimming of trailing zeroes enforced by the functions? HOT 5
- roundHalfEven working incorrectly? HOT 1
- using hexdec on PHP 7.4 logs: "PHP Deprecated: Invalid characters passed for attempted conversion" HOT 1
- Performance HOT 7
- BC return should always be string
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bcmath-extended.