php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75798 PDOException: Packets out of order
Submitted: 2018-01-11 09:24 UTC Modified: 2023-01-10 22:26 UTC
Votes:17
Avg. Score:4.4 ± 0.8
Reproduced:16 of 16 (100.0%)
Same Version:2 (12.5%)
Same OS:1 (6.2%)
From: terrywongvip at qq dot com Assigned:
Status: No Feedback Package: PDO MySQL
PHP Version: 7.1.13 OS: CentOS release 6.8 (Final)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: terrywongvip at qq dot com
New email:
PHP Version: OS:

 

 [2018-01-11 09:24 UTC] terrywongvip at qq dot com
Description:
------------
---
From manual page: http://www.php.net/book.pdo
---

When new a PDO instance with php7.1.13 , it will expose a fatal error , with mesage like "PDOException: Packets out of order" , but when I use php5.6.30 or php7.20 , it works and return a resource .

Test script:
---------------
--- code ---

$dbh = new PDO("mysql:host=127.0.0.1;port=3306;dbname=test","demo","demo");
var_dump($dbh);

--- error message ---

PHP Fatal error:  Uncaught PDOException: Packets out of order. Expected 3 received 2. Packet size=22 in /data1/www/xxx/admin/protected/test1.php:3
Stack trace:
#0 /data1/www/xxx/admin/protected/test1.php(3): PDO->__construct('mysql:host=10.1...', 'demo', 'demo')
#1 {main}

Next PDOException: SQLSTATE[HY000] [2006] MySQL server has gone away in /data1/www/xxx/admin/protected/test1.php:3


Actual result:
--------------
--- backtrace ---

#0  php_error_docref0 (docref=0x0, type=2, format=0xdd975e "%s") at /data1/download/php-7.1.13/main/main.c:970
#1  0x00000000007a4824 in mysqlnd_read_packet_header_and_body (packet_header=0x7ffff4278300, pfc=0x7ffff4270040, vio=0x7ffff4202120, 
    stats=<value optimized out>, error_info=0x7ffff426b120, connection_state=0x7ffff426b348, buf=0x7ffff4277000 "\270q'\364\377\177", 
    buf_size=4095, packet_type_as_text=0x8d0cb2 "OK", packet_type=PROT_OK_PACKET)
    at /data1/download/php-7.1.13/ext/mysqlnd/mysqlnd_wireprotocol.c:310
#2  0x00000000007a66e5 in php_mysqlnd_auth_response_read (_packet=0x7ffff4278300)
    at /data1/download/php-7.1.13/ext/mysqlnd/mysqlnd_wireprotocol.c:678
#3  0x00000000007ab1f7 in mysqlnd_auth_handshake (conn=0x7ffff426b000, user=<value optimized out>, passwd=<value optimized out>, 
    passwd_len=<value optimized out>, db=0x7ffff4272028 "test", db_len=4, session_options=0x7ffff426b378, mysql_flags=762509, server_charset_no=8, 
    use_full_blown_auth_packet=1 '\001', auth_protocol=0x7ffff4201440 "mysql_native_password", 
    auth_plugin_data=0x1337fe0 "\252h\aL\350b\031缸\301\326t\374\372M\366\066d\211", auth_plugin_data_len=20, 
    switch_to_auth_protocol=0x7fffffffa408, switch_to_auth_protocol_len=0x7fffffffa400, switch_to_auth_protocol_data=0x7fffffffa3f8, 
    switch_to_auth_protocol_data_len=0x7fffffffa3f0) at /data1/download/php-7.1.13/ext/mysqlnd/mysqlnd_auth.c:314
#4  0x00000000007ab732 in mysqlnd_run_authentication (conn=0x7ffff426b000, user=0x7ffff4272010 "demo", passwd=0x7ffff4272018 "demo", passwd_len=4, 
    db=0x7ffff4272028 "test", db_len=4, auth_plugin_data=..., auth_protocol=0x0, charset_no=8, session_options=0x7ffff426b378, mysql_flags=762509, 
    silent=0 '\000', is_change_user=0 '\000') at /data1/download/php-7.1.13/ext/mysqlnd/mysqlnd_auth.c:119


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-12-13 10:53 UTC] g dot barbot at webgis dot fr
Hi,

i have the same probleme on Php 8.0.0-dev

with PDO :
new PDO('mysql:host='.$dsn['hostspec'].';dbname='. $dsn['database'],$dsn['username'],$dsn['password'])

give error : Uncaught PDOException: Packets out of order. Expected 3 received 2. Packet size=22

with mysqli_connect : 

mysqli_connect($dsn['hostspec'],$dsn['username'],$dsn['password'],
$dsn['database'],$dsn['port'],$dsn['socket']);

give error : Packets out of order. Expected 3 received 2. Packet size=22

++
 [2020-10-28 12:16 UTC] nikic@php.net
What MySQL server version are you connecting to?
 [2023-01-10 22:26 UTC] dharman@php.net
-Status: Open +Status: No Feedback
 [2023-01-10 22:26 UTC] dharman@php.net
Sorry but this is not actionable without some information about what system we are connecting to.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC