Skip to content

Commit 7c511ce

Browse files
authored
Merge pull request #4 from Codeception/php7.4
PHP 7.4: Fix Trying to access array offset on value of type bool warning
2 parents 289028f + b9fe541 commit 7c511ce

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ php:
88
- 7.1
99
- 7.2
1010
- 7.3
11+
- 7.4snapshot
1112
# faster builds on new travis setup not using sudo
1213
sudo: false
1314

src/Codeception/Lib/InnerBrowser.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -865,11 +865,13 @@ protected function setCheckboxBoolValues(Crawler $form, array $params)
865865
if ($values === true) {
866866
$params[$fieldName] = $box->hasAttribute('value') ? $box->getAttribute('value') : 'on';
867867
$chFoundByName[$fieldName] = $pos + 1;
868-
} elseif ($values[$pos] === true) {
869-
$params[$fieldName][$pos] = $box->hasAttribute('value') ? $box->getAttribute('value') : 'on';
870-
$chFoundByName[$fieldName] = $pos + 1;
871868
} elseif (is_array($values)) {
872-
array_splice($params[$fieldName], $pos, 1);
869+
if ($values[$pos] === true) {
870+
$params[$fieldName][$pos] = $box->hasAttribute('value') ? $box->getAttribute('value') : 'on';
871+
$chFoundByName[$fieldName] = $pos + 1;
872+
} else {
873+
array_splice($params[$fieldName], $pos, 1);
874+
}
873875
} else {
874876
unset($params[$fieldName]);
875877
}

0 commit comments

Comments
 (0)