check if functions are disabled if failed to connect/listen - #97
Closed
MasterOdin wants to merge 1 commit into
Closed
check if functions are disabled if failed to connect/listen#97MasterOdin wants to merge 1 commit into
MasterOdin wants to merge 1 commit into
Conversation
Signed-off-by: Matthew Peveler <[email protected]>
Contributor
|
After some testing, I've found that the sustainable solution to this problem is to wrap sensitive calls in an error handler. This approach is more generic, catching all errors and not just disabled functions. Implemented in upcoming |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #93
Currently, if a user attempts to use these functions while they are disabled via php.ini, they will receive a message like
Could not open socket to "127.0.0.1:41983": (). This has can cause confusion to someone who might not know the function is disabled (or that you can disable functions), and just lead to spinning their wheels on trying to debug.This patch changes it such that if
$errstris null, it will check if the function is disabled and if so, will update the$errstrvariable to something more meaningful to be displayed to the user and logged. The$errnovariable remains null. In the above example, the user will now receive the following error message:Could not open socket to "127.0.0.1:41983": stream_socket_client function is disabled ().Given that this code relies on the function not existing, I'm not sure how I would include tests for this behavior. As such, I've ignored the lines in question for consideration of code coverage.