Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The log() method reports an error, there is a problem with type judgment 'double' => PDO::PARAM_STR. #1108

Closed
TimeIsGoOn opened this issue Jan 12, 2024 · 1 comment
Labels

Comments

@TimeIsGoOn
Copy link

TimeIsGoOn commented Jan 12, 2024

Information

  • Version of Medoo:v2.1.10
  • Version of PHP: 8.2.14
  • Type of Database (MySQL, MSSQL, SQLite...): Postgresql
  • System (Liunx|Windows|Mac):Linux

Describe the Problem
执行log()方法报错

TypeError: Medoo\Medoo::quote(): Argument #1 ($string) must be of type string, float given, called in /www/webman/vendor/catfan/medoo/src/Medoo.php on line 607 and defined in /www/webman/vendor/catfan/medoo/src/Medoo.php:696
Stack trace:
#0 /www/webman/vendor/catfan/medoo/src/Medoo.php(607): Medoo\Medoo->quote(555.1)
#1 /www/webman/vendor/catfan/medoo/src/Medoo.php(2205): Medoo\Medoo->generate('UPDATE "page" S...', Array)
#2 [internal function]: Medoo\Medoo->Medoo\{closure}(Array)
#3 /www/webman/vendor/catfan/medoo/src/Medoo.php(2203): array_map(Object(Closure), Array)
#4 /www/webman/app/wmapi/controller/PageController.php(215): Medoo\Medoo->log()

问题出在 

'double' => PDO::PARAM_STR,

image
这里 double 类型被看做了字符串,但是555.1不是字符串,
导致调用quote函数时参数类型检查错误

$replace = $this->quote($value[0]);

image

image

请看看这个如何修改,或者是在调用的时候,类型强制转换为 string

@catfan catfan changed the title log() 方法报错,类型判断有问题 'double' => PDO::PARAM_STR The log() method reports an error, there is a problem with type judgment 'double' => PDO::PARAM_STR. Jan 15, 2024
@catfan catfan added the bug label Jan 22, 2024
@catfan
Copy link
Owner

catfan commented Jan 22, 2024

Fixed it on b409028.

#1011
#1020

@catfan catfan closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants