ThingEngineer / PHP-MySQLi-Database-Class

Wrapper for a PHP MySQL class, which utilizes MySQLi and prepared statements.
Other
3.28k stars 1.35k forks source link

Deprecated on PHP 8.1.11: Calling end() on an object #1001

Closed aleixpellicer closed 2 months ago

aleixpellicer commented 1 year ago

Not working in 8.1.11:

Deprecated: end(): Calling end() on an object is deprecated in X:\UniServerZ_15\vhosts\vatiometrogiovanni\vendor\thingengineer\mysqli-database-class\MysqliDb.php on line 1675

Having to go back to php 7 in order to work

SilverOkami42 commented 1 year ago

I found a quick fix was to replace end($result) with $result->{array_key_last((array)$result)}

SilverOkami42 commented 1 year ago

I also discovered changing line 2058 to $val = $vals[$i++] ?? null; fixed it finding a array value that didn't exist.

RivenSkaye commented 1 year ago

I also discovered changing line 2058 to $val = $vals[$i++] ?? null; fixed it finding a array value that didn't exist.

This sounds like there are fewer elements in the array than question marks in the query. Granted, it'd be better to check that, but that should be a separate issue.