Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

fix Trying to access array offset on value of type null #395

Merged
merged 1 commit into from Dec 31, 2019

Conversation

remicollet
Copy link
Contributor

With 7.4.0RC3

There were 2 errors:

1) ZendTest\Db\RowGateway\AbstractRowGatewayTest::testDelete
Trying to access array offset on value of type null

/dev/shm/BUILDROOT/php-zendframework-zend-db-2.10.0-2.fc29.remi.x86_64/usr/share/php/Zend/Db/RowGateway/AbstractRowGateway.php:207
/dev/shm/BUILD/zend-db-77022f06f6ffd384fa86d22ab8d8bbdb925a1e8e/test/unit/RowGateway/AbstractRowGatewayTest.php:257

2) ZendTest\Db\TableGateway\AbstractTableGatewayTest::testSelectWithNoWhere
Trying to access array offset on value of type null

/dev/shm/BUILDROOT/php-zendframework-zend-db-2.10.0-2.fc29.remi.x86_64/usr/share/php/Zend/Db/TableGateway/AbstractTableGateway.php:219
/dev/shm/BUILDROOT/php-zendframework-zend-db-2.10.0-2.fc29.remi.x86_64/usr/share/php/Zend/Db/TableGateway/AbstractTableGateway.php:208
/dev/shm/BUILDROOT/php-zendframework-zend-db-2.10.0-2.fc29.remi.x86_64/usr/share/php/Zend/Db/TableGateway/AbstractTableGateway.php:196
/dev/shm/BUILD/zend-db-77022f06f6ffd384fa86d22ab8d8bbdb925a1e8e/test/unit/TableGateway/AbstractTableGatewayTest.php:163

@@ -204,7 +204,7 @@ public function delete()
$where = [];
// primary key is always an array even if its a single column
foreach ($this->primaryKeyColumn as $pkColumn) {
$where[$pkColumn] = $this->primaryKeyData[$pkColumn];
$where[$pkColumn] = ($this->primaryKeyData ? $this->primaryKeyData[$pkColumn] : null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two comments here:

  • brackets are redundant
  • we should use isset($this->primaryKeyData[$pkColumn]), imo

@michalbundyra michalbundyra added this to the 2.10.1 milestone Nov 26, 2019
@michalbundyra
Copy link
Member

Thanks, @remicollet!

michalbundyra added a commit that referenced this pull request Dec 31, 2019
fix Trying to access array offset on value of type null
michalbundyra added a commit that referenced this pull request Dec 31, 2019
@michalbundyra michalbundyra merged commit 1bab1f1 into zendframework:master Dec 31, 2019
michalbundyra added a commit that referenced this pull request Dec 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants