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

php 8.2 error with Carbon, comparison operator #1020

Open BataBoom opened 10 months ago

BataBoom commented 10 months ago
$currentDatetime = Carbon::now();
Error Query: $db->rawQuery("SELECT * FROM `am_store` WHERE `expires` < ".$currentDatetime->toDateTimeString());
Temporary Fix Query: $db->rawQuery("SELECT * FROM `am_store` WHERE `expires` < "."'".$currentDatetime->toDateTimeString()."'"); 

php verison 8.2.10 DEPRECATED str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated in vendor/thingengineer/mysqli-database-class/MysqliDb.php on line 559.

mysqli_sql_exception

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' 05:00:56' at line 1

at vendor/thingengineer/mysqli-database-class/MysqliDb.php:1995

$db->where ("expires", "<", $currentDatetime->toDateTimeString());
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '  2023-  09-  07   05:08:55 ?' at line   1

Appears to add wonky spaces. Also the temporary fix appears to only work for SELECT queries, not DELETE.

RivenSkaye commented 4 weeks ago

Fixed in the latest patch release and duplicate of #1016