[php-src] Issue #23956: Regression with MySQL 4.1 after mysqlnd security fix GHSA-r6x9-5r99-36j7

From: Date: Mon, 28 Sep 2026 07:06:43 +0000
Subject: [php-src] Issue #23956: Regression with MySQL 4.1 after mysqlnd security fix GHSA-r6x9-5r99-36j7
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252837@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/23956 Author: jeroenvdkolff ### Description ### Description After upgrading to the latest PHP versions (8.4.26, 8.5.11), connections to our legacy MySQL 4.1 server stopped working correctly. The same code works with PHP 8.4.25/8.5.10. Simple test: ```php <?php $mysqli = new mysqli( 'MYSQL_HOST', 'USERNAME', 'PASSWORD', 'DATABASE', 3306 ); var_dump( $mysqli->query('SELECT 1')->fetch_assoc() ); ``` ### Actual result On PHP 8.2.34 / 8.3.35 / 8.4.26 / 8.5.11: ``` Warning: mysqli::query(): Premature end of data (mysqlnd_wireprotocol.c:1018) in /app/test.php on line 12 Warning: mysqli::query(): EOF packet shorter than expected in /app/test.php on line 12 Fatal error: Uncaught Error: Call to a member function fetch_assoc() on false in /app/test.php:12 Stack trace: #0 {main} thrown in /app/test.php on line 12 ``` ### Expected result The SELECT 1 query should execute successfully, as it did in previous patch versions. PDO has the same problem. ### System PHP 8.5.11 / 8.4.26 / 8.3.35 / 8.2.34 (docker php:#.#-cli) The MySQL server is MySQL 4.1. OS: Ubuntu 26.04 / Debian 13 ### Suspected cause It looks like this behavior was introduced in the latest security releases across PHP 8.2 through 8.5, likely related to the changes in GHSA-r6x9-5r99-36j7: https://github.com/php/php-src/security/advisories/GHSA-r6x9-5r99-36j7 I am not a C developer, but while checking the source code of php_mysqlnd_eof_read() in mysqlnd_wireprotocol.c, I noticed a comment mentioning that MySQL 4.1 sends 1-byte EOF packets. Could the new packet boundary checks be accidentally treating these valid 1-byte legacy packets as premature/truncated data? ### PHP Version ```plain PHP 8.5.11 (cli) (built: Sep 24 2026 19:06:49) (NTS) Copyright (c) The PHP Group Built by https://github.com/docker-library/php Zend Engine v4.5.11, Copyright (c) Zend Technologies with Zend OPcache v8.5.11, Copyright (c), by Zend Technologies ``` ### Operating System Ubuntu 26.04 / Debian 12 / Docker php cli images

« previous php.bugs (#252837) next »