Bug #72416 [Ver->Fbk]: mysqli_stmt::__construct(): Unknown type 18 sent by the server.

From: Date: Mon, 20 Jun 2016 17:30:54 +0000
Subject: Bug #72416 [Ver->Fbk]: mysqli_stmt::__construct(): Unknown type 18 sent by the server.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201763@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72416&edit=1

 ID:                 72416
 Updated by:         andrey@php.net
 Reported by:        webart dot video at gmail dot com
 Summary:            mysqli_stmt::__construct(): Unknown type 18 sent by
                     the server.
-Status:             Verified
+Status:             Feedback
 Type:               Bug
 Package:            MySQLi related
 Operating System:   Ubuntu 14.04 LTS
 PHP Version:        7.0.7
 Assigned To:        mysql
 Block user comment: N
 Private report:     N

 New Comment:

Hi,
can you tell us what MySQL version you are using and could you produce a bit minimal script that
generates the error and the crash.
I tried myself with 7.0 and 7.1 but no crash. Here is my table:

mysql> create table dt(a datetime(6));
Query OK, 0 rows affected (0,01 sec)

mysql> insert into dt values ('2014-09-08 17:51:04.123456');
Query OK, 1 row affected (0,01 sec)

mysql> select * from dt;
+----------------------------+
| a                          |
+----------------------------+
| 2014-09-08 17:51:04.123456 |
+----------------------------+
1 row in set (0,00 sec)


Then on the command line:
andrey@poohie:/work/dev/php/php-7.0$ ./php -r
'$c=mysqli_connect("127.0.0.1","root","","test");
$s=$c->prepare("select * from dt");
$s->execute();var_dump($s->get_result()->fetch_all());'
array(1) {
  [0]=>
  array(1) {
    [0]=>
    string(19) "2014-09-08 17:51:04"
  }
}

And in wireshark I see that FIELD_DATETIME (12) is sent over the wire. Type 18 is DATETIME2, which
is DATETIME with microseconds. However, mysqlnd here doesn't see the microseconds as DATETIME
is sent. I am curious what triggered the server to send the microseconds and the new type. This is
why I would like to see a shorter example of your code that is self contained (or is one small PHP
and one small SQL dump file).

Thank you very much in advance!

Andrey


Previous Comments:
------------------------------------------------------------------------
[2016-06-19 07:00:55] laruence@php.net

5.6 is also affected

------------------------------------------------------------------------
[2016-06-15 15:06:59] webart dot video at gmail dot com

Description:
------------
PHP Information:

PHP 7.0.7-4+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
    with blackfire v1.10.6, https://blackfire.io, by Blackfireio
Inc.

Pretty simple, using $mysqli->prepare($query) crashes the server with the message 
"mysqli_stmt::__construct(): Unknown type 18 sent by the server. Please send a report to the
developers"



Test script:
---------------
https://gist.github.com/NoMan2000/0ee7fbf41f69a7ae4cdc555241e2e5f6

Refer bug: https://bugs.php.net/bug.php?id=72041&edit=1

The difference is that user is using PDO, I'm using mysqli, but the underlying cause seems to
be the same.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=72416&edit=1


Thread (15 messages)

« previous php.bugs (#201763) next »