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

trigger a strange PDO syntax error #1281

Open
landall opened this issue Apr 1, 2024 · 7 comments
Open

trigger a strange PDO syntax error #1281

landall opened this issue Apr 1, 2024 · 7 comments

Comments

@landall
Copy link

landall commented Apr 1, 2024

Server: CentOS 7
PHP 7.4.33
SQLite version 3.7.17
Cli & Apache mode all trigger it.

vendor/bcosca/fatfree-core/db/sql.php:268 report this error.

I insert a var_dump($cmd) in line 183.

Output is:
string(137) "SELECT * FROM pragma_table_info('Versions') JOIN (SELECT sql FROM sqlite_master WHERE (type='table' OR type='view') AND name='Versions')"

The Output in Windows 10 & PHP 7.4.19 is:
string(137) "SELECT * FROM pragma_table_info('Versions') JOIN (SELECT sql FROM sqlite_master WHERE (type='table' OR type='view') AND name='Versions')"

It reports PDO: near "(": syntax error in CentOS 7 but works in Windows.

@landall
Copy link
Author

landall commented Apr 1, 2024

Also works in PHP 7.4.30 / AlmaLinux 8 / sqlite 3.26.0

@landall
Copy link
Author

landall commented Apr 1, 2024

Report Error in PHP 8.0 / CentOS 7

@Rayne
Copy link
Contributor

Rayne commented Apr 2, 2024

According to the search in Mozilla Firefox, both outputs are the same. Is the output different at all? If not, then this looks like an issue in PHP 7.4.33?

@landall
Copy link
Author

landall commented Apr 2, 2024

According to the search in Mozilla Firefox, both outputs are the same. Is the output different at all? If not, then this looks like an issue in PHP 7.4.33?

I do not have more vps to test it in more php versions and distributions.
Maybe an issue about some new php version?
Is there any way to know why PDO thinks the sql is wrong?

@Rayne
Copy link
Contributor

Rayne commented Apr 2, 2024

I can somewhat reproduce the issue with an online tool but have no time to inspect it in detail: https://onlinephp.io/c/d14c7

I insert a var_dump($cmd) in line 183.

Where exactly do you output the debug information? Which commit is fatfree-core?

@landall
Copy link
Author

landall commented Apr 2, 2024

I can somewhat reproduce the issue with an online tool but have no time to inspect it in detail: https://onlinephp.io/c/d14c7

I insert a var_dump($cmd) in line 183.

Where exactly do you output the debug information? Which commit is fatfree-core?

bcosca/fatfree-core 3.8.2,https://api.github.com/repos/f3-factory/fatfree-core/zipball/774692ce7698904d3cb35bbd4f79376bb17eeddc

Another hint.
php 7.4.30 in AlmaLinux 8 installed from appstream(AlmaLinux Official repo)
php 7.4.33 in CentOS 7 installed from remi-php74

@landall
Copy link
Author

landall commented Apr 2, 2024

Where exactly do you output the debug information?

	/**
	*	Execute SQL statement(s)
	*	@return array|int|FALSE
	*	@param $cmds string|array
	*	@param $args string|array
	*	@param $ttl int|array
	*	@param $log bool
	*	@param $stamp bool
	**/
	function exec($cmds,$args=NULL,$ttl=0,$log=TRUE,$stamp=FALSE) {

This function generates a set of SQL cmds.
and I print out the sqls in the loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants