-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Conversation
@@ -45,7 +45,9 @@ public function init($operand, $base = null) | |||
} | |||
} | |||
|
|||
set_error_handler(function () { /* Do nothing */}, \E_WARNING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly can go wrong here in 5.6?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"[math][php-56] PHP now throws E_WARNING when string is not a valid gm… …
…p integer."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DASPRiD see https://travis-ci.org/zendframework/zf2/jobs/20643164#L695
@Maks3w is error suppression actually how we're supposed to deal with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought in throw InvalidArgumentException
but interface contract explictly use false
for errors handling.
$res
still having false
as value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For that error handler setting, don't we have something in Stdlib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I second @DASPRiD - that's exactly why ErrorHandler was created, so I see no reason not to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefixing it with @
is not enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not allowed within ZF2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is another approach. Just silent the warning in the unit test and let it throw in production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @zendframework/community-review-team |
should be possible to check for warning thrown in phpunit (?convert to exception) for php 5.6+ |
As I said. |
@Maks3w I meant only in unit test - split them to good X bad and for bad ones something like
or
|
@ezimuel what is your take on this? Is a warning expected? |
I think the fix proposed by @Maks3w is ok in that specific case. The use of Zend\Stdlib\ErrorHandler seems to be verbose here. False is perfectly fine because it evidences that the number that you are trying to create with BigInteger is not valid. We don't need more info on that. |
@ezimuel can you merge then? Or eventually I can do that as well. |
@Ocramius go for it, thanks! |
…bility' into develop Close zendframework/zendframework#5957 Forward Port zendframework/zendframework#5957
…bility' into develop Close zendframework/zendframework#5957 Forward Port zendframework/zendframework#5957
No description provided.