Skip to content

Commit e6ca69c

Browse files
committed
Fix undefined index bug in PHP 5 and HHVM
1 parent 6e95d2c commit e6ca69c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/AbstractConfig.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,12 @@ public function addSection($key, $data = [], $comment = null)
220220
*/
221221
public function &offsetGet($offset)
222222
{
223+
// @codeCoverageIgnoreStart
224+
if (!isset($this->data[$offset])) {
225+
$this->data[$offset] = null;
226+
}
227+
// @codeCoverageIgnoreEnd
228+
223229
return $this->data[$offset];
224230
}
225231

src/Record.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ public function __construct($value = null, $comment = null)
5252
*/
5353
public function &offsetGet($offset)
5454
{
55+
// @codeCoverageIgnoreStart
56+
if (!isset($this->value[$offset])) {
57+
$this->value[$offset] = null;
58+
}
59+
// @codeCoverageIgnoreEnd
60+
5561
return $this->value[$offset];
5662
}
5763
/**

0 commit comments

Comments
 (0)