php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65929 RSET_HEADER pack size err PDO out/inout parameter
Submitted: 2013-10-18 14:15 UTC Modified: 2021-07-13 13:16 UTC
Votes:8
Avg. Score:4.5 ± 0.7
Reproduced:8 of 8 (100.0%)
Same Version:3 (37.5%)
Same OS:2 (25.0%)
From: johanafm at gmail dot com Assigned: cmb (profile)
Status: Closed Package: PDO MySQL
PHP Version: 5.5.5 OS: OSX 10.8.5
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: johanafm at gmail dot com
New email:
PHP Version: OS:

 

 [2013-10-18 14:15 UTC] johanafm at gmail dot com
Description:
------------
As reported by phpinfo
pdo_mysql: mysqlnd 5.0.11-dev - 20120503 - $Id: 40933630edef551dfaca71298a83fad8d03d62d4 $ 



Test script:
---------------
# The php code below makes use of this stored proc
DELIMITER ##
CREATE PROCEDURE out_bug(OUT param INT UNSIGNED)
BEGIN
    SET param := 3;
END##
DELIMITER ;

# php - prepard statement of above stored proc
$out = 0;
$s = $db->prepare('CALL out_bug(:out)');
$s->bindParam('out', $out, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, 4);
$s->execute();
echo 'out is: ' . $out;


Expected result:
----------------
I would have expected the php code to execute without errors
and $out to contain the value '3' as set in the stored procedure.

Actual result:
--------------
Warning: PDOStatement::execute(): Premature end of data (mysqlnd_wireprotocol.c:1113)
Warning: PDOStatement::execute(): RSET_HEADER packet 1 bytes shorter than expected
Warning: PDOStatement::execute(): Error reading result set's header

Warning: PDOStatement::execute(): Premature end of data (mysqlnd_wireprotocol.c:1076)
Warning: PDOStatement::execute(): RSET_HEADER packet 4 bytes shorter than expected
Warning: PDOStatement::execute(): Error reading result set's header
out is: 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-02 14:46 UTC] tpunt@php.net
-Package: mysql +Package: PDO MySQL
 [2020-11-26 14:20 UTC] nikic@php.net
I can't reproduce the "premature end of data" etc warnings, but I don't get a result either ($out stays zero). I had to disable emulated prepares to make it work at all.
 [2021-07-13 13:16 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-07-13 13:16 UTC] cmb@php.net
I can confirm @nikic's findings, i.e. the warnings have been
resolved, but $out is not modified.  It seems to me we would have
to do something on PDO_PARAM_EVT_EXEC_POST instead of doing
nothing[1].

However, the PHP manual already states[2]:

| Some drivers support the invocation of stored procedures that
| return data as output parameters, and some also as input/output
| parameters that both send in data and are updated to receive it.

I have clarified this for the MySQL driver[3].  There is already
request #79893 regarding proper inout/out parameter support, so
this ticket can be closed.

[1] <https://github.com/php/php-src/blob/PHP-7.4.21/ext/pdo_mysql/mysql_statement.c#L606-L612>
[2] <https://www.php.net/manual/en/pdostatement.bindparam.php#refsect1-pdostatement.bindparam-description>
[3] <https://github.com/php/doc-en/commit/14667574fb52348d6fb15471f53d244e9ca3f68e>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 23:01:29 2024 UTC