-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fixing incorrect error message when passing null to join/implode's array parameter #12683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
469981b
Fixes #12682
CViniciusSDias af47cdf
Adding correct check and error message
CViniciusSDias b2494f1
Splitting paths as suggested by @iluuu1994
CViniciusSDias 0581bf1
Fixing parameters parsing
CViniciusSDias d3524bd
Simplifying the parameter check conditions
CViniciusSDias 737d829
Tests fixed and code approach reverted to the original one
CViniciusSDias 63648cc
Removing duplicated test
CViniciusSDias 48a080e
Rewriting the error message and moving test conditions
CViniciusSDias b56c486
Removing deprecation test
CViniciusSDias 5ac3431
Fixing tests with the new error message
CViniciusSDias f5b351e
Using the new error message always with null
CViniciusSDias 2193972
Adding closing tag to test and removing unreacheable statement
CViniciusSDias e86f567
Reverting checks to original structure, changing only the error messages
CViniciusSDias 95b8db9
Making tests PSR-12 compliant
CViniciusSDias File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
Test implode() function: error conditions | ||
--FILE-- | ||
<?php | ||
/* only glue */ | ||
try { | ||
var_dump(implode("glue")); | ||
} catch (TypeError $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
|
||
/* NULL as pieces */ | ||
try { | ||
var_dump(implode("glue", NULL)); | ||
} catch (TypeError $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
|
||
/* integer as glue */ | ||
try { | ||
var_dump(implode(12, "pieces")); | ||
} catch (TypeError $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
CViniciusSDias marked this conversation as resolved.
Show resolved
Hide resolved
|
||
?> | ||
--EXPECT-- | ||
implode(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given | ||
implode(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given | ||
implode(): Argument #2 ($array) must be of type ?array, string given |
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.