Skip to content

Commit

Permalink
Fix reset() warning (#33)
Browse files Browse the repository at this point in the history
* Update Statement.php

Calling \get_mangled_object_vars($row ) first to prevent warning from calling \reset() on an object (as per PHP 8.1)

* Bump
  • Loading branch information
MWilm authored Sep 2, 2022
1 parent 98106f7 commit d432ec4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/Pdo/Cache/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ public function fetchAll(int $mode = PDO::FETCH_OBJ, mixed ...$args): array
$this->results = [];

while ($row = $this->fetch()) {
if ((\is_array($row) || \is_object($row)) && \is_resource(\reset($row))) {
$stmt = new self($this->connection, \reset($row), $this->options);
$mangledObj = \get_mangled_object_vars($row);

if ((\is_array($row) || \is_object($row)) && \is_resource(\reset($mangledObj))) {
$stmt = new self($this->connection, \reset($mangledObj), $this->options);
$stmt->execute();
$stmt->setFetchMode($mode);

Expand Down

0 comments on commit d432ec4

Please sign in to comment.