Skip to content

Commit

Permalink
Fix issue on PHP 7.2 & 7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Apr 20, 2021
1 parent 5ebcd63 commit bb3177c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Engine/PDOEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ protected function executeQuery(string $query, array $parameters) : array

$this->pdo->setAttribute(\PDO::ATTR_ERRMODE, $errMode);

assert($result !== false);
if ($result === false) {
// not sure why, but on PHP 7.2 & 7.3, running a query for a non-supported operation
// yields no exception, no error (SQLSTATE 00000), but returns false; works fine in PHP 7.4+
throw GeometryEngineException::operationNotSupportedByEngine();
}

return $result;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/GeometryEngineException.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public static function unimplementedMethod(string $methodName) : GeometryEngineE
}

/**
* @param \Exception $e
* @param \Exception|null $e
*
* @return GeometryEngineException
*/
public static function operationNotSupportedByEngine(\Exception $e) : GeometryEngineException
public static function operationNotSupportedByEngine(?\Exception $e = null) : GeometryEngineException
{
return new self('This operation is not supported by the geometry engine.', 0, $e);
}
Expand Down

0 comments on commit bb3177c

Please sign in to comment.