|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2017-01-31 11:00 UTC] mavgust at radaris dot com
 Description:
------------
IF size of all reading fields from mysql table  >MEDIUMBLOB (16777215), last field broken 
In php version 7.1.0 all right
Test script:
---------------
$table = 'test';
$m = mysqli_connect("lacalhost", "user", "pwd", "db");
$m->query("CREATE TABLE `".$table."` (  `id` tinyint(4) NOT NULL,  
            `first` mediumblob NOT NULL,
            `second` mediumblob NOT NULL,
            `third` mediumblob NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM");
$sm = $m->prepare("INSERT INTO ".$table." (id,first, second, third) VALUES (?,?,?,?)");    
$sm->bind_param("isss",$id,$d,$d,$d);
$id =  1;
$d = str_pad("1", 6000000, "1");
$sm->execute();
$sm->close();
$res = $m->query("select first,second,third from ".$table." where id=1");
$r=$res->fetch_array();
echo "\n\nFirst: ".md5($r['first']). "\nSecond: ".md5($r['second']). "\nThird: ".md5($r['third']);
$res = $m->query("select third,first,second from ".$table." where id=1");
$r=$res->fetch_array();
echo "\n\nFirst: ".md5($r['first']). "\nSecond: ".md5($r['second']). "\nThird: ".md5($r['third']);
$res = $m->query("select second,third,first from ".$table." where id=1");
$r=$res->fetch_array();
echo "\n\nFirst: ".md5($r['first']). "\nSecond: ".md5($r['second']). "\nThird: ".md5($r['third']);
Expected result:
----------------
First: 0ee40b4246130ee135b58c07382e69f6
Second: 0ee40b4246130ee135b58c07382e69f6
Third: 0ee40b4246130ee135b58c07382e69f6
Actual result:
--------------
First: 0ee40b4246130ee135b58c07382e69f6
Second: 0ee40b4246130ee135b58c07382e69f6
Third: c7090cb3ccbc696b3c6cc1e6c4c2fb29
First: 0ee40b4246130ee135b58c07382e69f6
Second: c7090cb3ccbc696b3c6cc1e6c4c2fb29
Third: 0ee40b4246130ee135b58c07382e69f6
First: c7090cb3ccbc696b3c6cc1e6c4c2fb29
Second: 0ee40b4246130ee135b58c07382e69f6
Third: 0ee40b4246130ee135b58c07382e69f6
PatchesPull Requests
Pull requests: 
 HistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Wed Oct 22 16:00:01 2025 UTC | 
max_allowed_packet | 67108864 I try $res = $m->query("SELECT RPAD('1',9000000,'1') as a,RPAD('1',9000000,'1') as b") $r = $res->fetch_array() md5($r['a']) = 42ca0fd16ab6b6d4b9d47dc0a4a8b12a md5($r['b']) = 6344f4429e683a9d37bef06feecbfe87 BUT REQUEST $m->query("SELECT RPAD('1',9000000,'1') as a,RPAD('1',9000000,'1') as b,'test' as c") Return ERROR mysqli_result::fetch_array(): Malformed server packet. Field length pointing 44 bytes after end of packet I downgrade php package from php.x86_64 0:7.1.1-2.el7.remi to php.x86_64 0:7.1.0-1.el7.remi and all work fineI test in php 7.1.2 this bug not fixed $res = $m->query("SELECT RPAD('1',9000000,'1') as a,RPAD('1',9000000,'1') as b") $r = $res->fetch_array() md5($r['a']) = 42ca0fd16ab6b6d4b9d47dc0a4a8b12a md5($r['b']) = 6344f4429e683a9d37bef06feecbfe87