pwg.categories.php #731

Open
opened 2026-10-05 00:14:28 +02:00 by adam · 0 comments
Owner

I got this error after updating to piwigo version 1.9.2. I'm not entirely sure of the circumstances, but it looks like the array handling is at some point injecting or allowing a blank value to get into the sql generated. I've obfuscated the IP address and server hostname, but otherwise the stacktrace is as recorded by the server.

2017/11/16 20:42:50 [error] 25173#25173: *830 FastCGI sent in stderr: "PHP message: PHP Warning: [mysql error 1064] 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 '220)
AND status = 'private'' at line 3

SELECT id
FROM piwigo_categories
WHERE id IN (,220)
AND status = 'private'
; in /var/www/html-content/piwigo/include/dblayer/functions_mysqli.inc.php on line 845
PHP message: PHP Fatal error: Uncaught Error: Call to a member function fetch_assoc() on boolean in /var/www/html-content/piwigo/include/dblayer/functions_mysqli.inc.php:906
Stack trace:
#0 /var/www/html-content/piwigo/admin/include/functions.php(2665): query2array('\nSELECT id\n FR...', NULL, 'id')
#1 /var/www/html-content/piwigo/admin/include/functions.php(1546): add_permission_on_category(Array, Array)
#2 /var/www/html-content/piwigo/include/ws_functions/pwg.categories.php(573): create_virtual_category('uploads-1291174...', 217, Array)
#3 /var/www/html-content/piwigo/include/ws_core.inc.php(608): ws_categories_add(Array, Object(PwgServer))
#4 /var/www/html-content/piwigo/include/ws_protocols/rest_handler.php(56): PwgServer->invoke('pwg.categories....', Array)
#5 /var/www/html-content/piwigo/include/ws_core.inc.php(296): PwgRestRequestHandler->handleRequest(Object(PwgServer))
#6 /var/www/html-content/piwigo/ws.php(94): PwgServer->run()
#7 {main}
thrown in /var/www/html-content/piwi" while reading response header from upstream, client: 99.999.999.999, server: example.server.com, request: "POST /piwigo/ws.php?format=json HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "example.server.com"
2017/11/16 20:42:52 [error] 25173#25173: *833 FastCGI sent in stderr: "PHP message: PHP Warning: [mysql error 1064] 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 '221)
AND status = 'private'' at line 3

I got this error after updating to piwigo version 1.9.2. I'm not entirely sure of the circumstances, but it looks like the array handling is at some point injecting or allowing a blank value to get into the sql generated. I've obfuscated the IP address and server hostname, but otherwise the stacktrace is as recorded by the server. 2017/11/16 20:42:50 [error] 25173#25173: *830 FastCGI sent in stderr: "PHP message: PHP Warning: [mysql error 1064] 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 '220) AND status = 'private'' at line 3 SELECT id FROM piwigo_categories WHERE id IN (,220) AND status = 'private' ; in /var/www/html-content/piwigo/include/dblayer/functions_mysqli.inc.php on line 845 PHP message: PHP Fatal error: Uncaught Error: Call to a member function fetch_assoc() on boolean in /var/www/html-content/piwigo/include/dblayer/functions_mysqli.inc.php:906 Stack trace: #0 /var/www/html-content/piwigo/admin/include/functions.php(2665): query2array('\nSELECT id\n FR...', NULL, 'id') #1 /var/www/html-content/piwigo/admin/include/functions.php(1546): add_permission_on_category(Array, Array) #2 /var/www/html-content/piwigo/include/ws_functions/pwg.categories.php(573): create_virtual_category('uploads-1291174...', 217, Array) #3 /var/www/html-content/piwigo/include/ws_core.inc.php(608): ws_categories_add(Array, Object(PwgServer)) #4 /var/www/html-content/piwigo/include/ws_protocols/rest_handler.php(56): PwgServer->invoke('pwg.categories....', Array) #5 /var/www/html-content/piwigo/include/ws_core.inc.php(296): PwgRestRequestHandler->handleRequest(Object(PwgServer)) #6 /var/www/html-content/piwigo/ws.php(94): PwgServer->run() #7 {main} thrown in /var/www/html-content/piwi" while reading response header from upstream, client: 99.999.999.999, server: example.server.com, request: "POST /piwigo/ws.php?format=json HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "example.server.com" 2017/11/16 20:42:52 [error] 25173#25173: *833 FastCGI sent in stderr: "PHP message: PHP Warning: [mysql error 1064] 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 '221) AND status = 'private'' at line 3 <!-- github-sync-id:275816681 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#731