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

bccomp() type error on certain MySQL column types #45

Open
Endermanbugzjfc opened this issue Aug 10, 2020 · 5 comments
Open

bccomp() type error on certain MySQL column types #45

Endermanbugzjfc opened this issue Aug 10, 2020 · 5 comments
Labels

Comments

@Endermanbugzjfc
Copy link
Contributor

Endermanbugzjfc commented Aug 10, 2020

Describe the bug

image

Fatal error: Uncaught TypeError: bccomp() expects parameter 1 to be string, int given in phar:///home/container/virions/libasynql.phar/src/poggit/libasynql/mysqli/MysqliThread.php:186
Stack trace:
#0 phar:///home/container/virions/libasynql.phar/src/poggit/libasynql/mysqli/MysqliThread.php(186): bccomp(1, '922337203685477...')
#1 phar:///home/container/virions/libasynql.phar/src/poggit/libasynql/mysqli/MysqliThread.php(224): poggit\libasynql\mysqli\MysqliThread->poggit\libasynql\mysqli\{closure}(1)
#2 phar:///home/container/virions/libasynql.phar/src/poggit/libasynql/mysqli/MysqliThread.php(155): poggit\libasynql\mysqli\MysqliThread->toSelectResult(Object(mysqli_result))
#3 phar:///home/container/virions/libasynql.phar/src/poggit/libasynql/base/SqlSlaveThread.php(85): poggit\libasynql\mysqli\MysqliThread->executeQuery(Object(mysqli), 3, 'SELECT record_i...', Array)
#4 [internal function]: poggit\libasynql\base\SqlSlaveThread->run()
#5 {main}
thrown in phar:///home/container/virions/libasynql.phar/src/poggit/libasynql/mysqli/MysqliThread.php on line 186

Sample code

-- # 			{ pre_registered
-- # 			  :username string
SELECT record_id
FROM pre_registered
WHERE username = :username
LIMIT 1;
-- # 			}

Expected behavior

record_id is a unsigned bigint, the error didn't occur when no result is selected

Environment

OS: linux and idk other stuffs (Same result on Windows10)
PocketMine version: 3.14.2
Libasynql version: 3.3.1

@Endermanbugzjfc
Copy link
Contributor Author

Endermanbugzjfc commented Aug 10, 2020

Somehow fixed by setting record_id to unsigned int

@SOF3
Copy link
Member

SOF3 commented Aug 11, 2020

This seems a bug indeed.

@SOF3 SOF3 reopened this Aug 11, 2020
@SOF3 SOF3 added the bug label Aug 11, 2020
@SOF3 SOF3 changed the title I don't know why but this happened bccomp() type error on certain MySQL field types Aug 11, 2020
@SOF3 SOF3 changed the title bccomp() type error on certain MySQL field types bccomp() type error on certain MySQL column types Aug 11, 2020
@matcracker
Copy link
Member

matcracker commented May 5, 2021

Hi, I had the same problem today. Why is it necessary to manage precision? We shouldn't worry as we are using PHP 64-bit.

Otherwise we need to use CONVERT function or use GMP extension but I don't think it's included in PocketMine binaries files.

@matcracker
Copy link
Member

However, there would be a problem, int casting is not possible. We must therefore transform the value into a float.

@SOF3
Copy link
Member

SOF3 commented May 6, 2021

unsigned longs?

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

3 participants