-
Notifications
You must be signed in to change notification settings - Fork 498
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
FilteredIterator: fix PHP 5.2/5.3 compatibility and actually run the tests #457
Conversation
Codecov Report
@@ Coverage Diff @@
## master #457 +/- ##
============================================
- Coverage 93.06% 93.01% -0.06%
- Complexity 764 765 +1
============================================
Files 21 21
Lines 1788 1789 +1
============================================
Hits 1664 1664
- Misses 124 125 +1
Continue to review full report at Codecov.
|
I've added a second commit to enable actually running the test.... |
The build against PHP 5.2 is failing for this PR and I'm wondering whether to spend time on fixing the test for this or to just skip this particular test on PHP 5.2. @schlessera Opinion ? |
00a63bf
to
de177d0
Compare
The `$callback` passed to the constructor of the `FilteredIterator` class may not be callable and if so, would cause a fatal error. This puts some defensive coding in place to guard against that and adds a unit test for it as well. This also fixes the tests failing on PHP 5.2, as when the object is unserialized on PHP 5.2, the `$callback` property will no longer be set. This looks to have been a bug in PHP 5.2 which was fixed in PHP 5.3.
Even though the code is wrapped in a version check for running, the code still needs to parse correctly on low PHP versions. This was not the case now, which would break the running of the tests of PHP 5.3. Fixed now.
As all tests are explicitly named in the test configuration, the test for the `FilteredIterator` as added in 422 were not being run as they hadn't been added to the config. This fixes that.
Okay, fixed it as the fix which is needed for 5.2, actually makes sense for all PHP versions anyhow. So I've added (yet another) commit and updated the PR description to cover all three changes. |
de177d0
to
3621755
Compare
This is now ready for merge - passing build: https://travis-ci.org/github/WordPress/Requests/builds/763756355 PHP 8 is failing as discussed in #439. Doesn't really matter as |
FilteredIterator: fix PHP 5.2 compatibility and stabilize the code
The
$callback
passed to the constructor of theFilteredIterator
class may not be callable and if so, would cause a fatal error.This puts some defensive coding in place to guard against that and adds a unit test for it as well.
This also fixes the tests failing on PHP 5.2, as when the object is unserialized on PHP 5.2, the
$callback
property will no longer be set. This looks to have been a bug in PHP 5.2 which was fixed in PHP 5.3.Tests/FilteredIterator: fix a parse error on PHP 5.3
Even though the code is wrapped in a version check for running, the code still needs to parse correctly on low PHP versions.
This was not the case now, which could break the running of the tests of PHP 5.3.
Fixed now.
Tests: actually run the test for the FilteredIterator
As all tests are explicitly named in the test configuration, the test for the
FilteredIterator
as added in #422 were not being run as they hadn't been added to the config.This fixes that.