Skip to content

Commit

Permalink
Merge pull request #4 from Codeception/php7.4
Browse files Browse the repository at this point in the history
PHP 7.4: Fix Trying to access array offset on value of type bool warning
  • Loading branch information
Naktibalda authored Dec 6, 2019
2 parents 289028f + b9fe541 commit 7c511ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4snapshot
# faster builds on new travis setup not using sudo
sudo: false

Expand Down
10 changes: 6 additions & 4 deletions src/Codeception/Lib/InnerBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,11 +865,13 @@ protected function setCheckboxBoolValues(Crawler $form, array $params)
if ($values === true) {
$params[$fieldName] = $box->hasAttribute('value') ? $box->getAttribute('value') : 'on';
$chFoundByName[$fieldName] = $pos + 1;
} elseif ($values[$pos] === true) {
$params[$fieldName][$pos] = $box->hasAttribute('value') ? $box->getAttribute('value') : 'on';
$chFoundByName[$fieldName] = $pos + 1;
} elseif (is_array($values)) {
array_splice($params[$fieldName], $pos, 1);
if ($values[$pos] === true) {
$params[$fieldName][$pos] = $box->hasAttribute('value') ? $box->getAttribute('value') : 'on';
$chFoundByName[$fieldName] = $pos + 1;
} else {
array_splice($params[$fieldName], $pos, 1);
}
} else {
unset($params[$fieldName]);
}
Expand Down

0 comments on commit 7c511ce

Please sign in to comment.