1

Raw mysql-client: (Good)

mysql> SELECT blobfield FROM `mytable` WHERE `id` = 46361 ;
{"example":"日本語...", "everything": "ok"}

phpMyAdmin > Export > SQL: (Good)

(46361, 0x7b226578616d706c65223a223f3f3f2e2e2e222c202265766572797468696e67223a20226f6b227d);

phpMyAdmin > Browse > Click over BLOB field: (Fail. Only partial-saved)

{"example":"日本語...", "everythi

(edit) curl (phpMyAdmin request):

curl 'http://127.0.0.1:48001/tbl_get_field.php?db=develop&table=mytable&where_clause=%60mytable%60.%60id%60+%3D+46361&transform_key=data&sql_query=SELECT+id%2Cdata+FROM+%60mytable%60+WHERE+id%3D46361&token=removed' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0'
{"example":"日本語...", "everythi

(edit2) (In verbose mode I found an error...)

< HTTP/1.1 200 OK
* Server nginx/1.6.2 is not blacklisted
< Server: nginx/1.6.2
< Date: Mon, 13 Apr 2015 10:45:08 GMT
< Content-Type: application/octet-stream
< Content-Length: **6453**
< Connection: keep-alive
< X-Powered-By: PHP/5.5.22-1~dotdeb.1
< Expires: Mon, 13 Apr 2015 10:45:08 +0000
< Cache-Control: no-store, no-cache, must-revalidate,  pre-check=0, post-check=0, max-age=0
< Pragma: no-cache
< Last-Modified: Mon, 13 Apr 2015 10:45:08 +0000
< Content-Description: File Transfer
< Content-Disposition: attachment; filename="mytable-data.bin"
< Content-Transfer-Encoding: binary

 * Excess found in a non pipelined read: excess = **1338**, size = 6453, maxdownload = 6453, bytecount = 0 .

Is anybody having the same issue? I guess that phpMyAdmin is sending a wrong Content-Length value.

My configuration:

  • Mysql: 5.6.23-log
  • phpMyAdmin: 4.4.1.1
  • connection: utf8mb4_bin (auto-switch from utf8_bin)
  • innodb: utf8_bin
  • nginx/1.7.9
  • php: 5.6.4-1+deb.sury.org~trusty+1 + mysqli
SergioArcos
  • 404
  • 6
  • 13
  • possible duplicate of [Viewing Content Of Blob In phpMyAdmin](http://stackoverflow.com/questions/2188264/viewing-content-of-blob-in-phpmyadmin) – CBroe Apr 13 '15 at 09:50
  • 1
    I don't want to view the content, I want to download it. The problem is not related as here I got corrupted data. – SergioArcos Apr 13 '15 at 10:02

1 Answers1

1

In file "tbl_get_field.php" I found:

PMA_downloadHeader(
    $table . '-' .  $_GET['transform_key'] . '.bin',
    PMA_detectMIME($result),
    /*overload*/mb_strlen($result)
);

Last line calculate using internal mb_internal_encoding() the total length. In my case, it's set to UTF-8.

Changing to:

/*overload*/mb_strlen($result, '8bit')

solved my problem. Info here: http://php.net/manual/en/function.mb-strlen.php#77040

Line added into my Dockerfile:

RUN sed -i.bak s/mb_strlen\(\$result\)/mb_strlen\(\$result,\'8bit\'\)/g /data/http/tbl_get_field.php
SergioArcos
  • 404
  • 6
  • 13