php mysqli fetch warning

Bug #1675117 reported by Kelvin Middleton on 2017-03-22
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php7.0 (Ubuntu)
Undecided
Unassigned

Bug Description

Hi, I hit an issue with phpMyAdmin and submitted it as an issue with them on github (https://github.com/phpmyadmin/phpmyadmin/issues/13117) however it concluded the problem lies with PHP and its mysql interface.

My server uses all stock packages from the ubuntu repositories:
phpmyadmin ver 4.5.4.1deb2ubuntu2.
Apache/2.4.18 (Ubuntu)
PHP version: 7.0.15-0ubuntu0.16.04.4

Using the below code:

<?php
error_reporting(E_ALL);

$link = mysqli_connect("localhost", "my_user", "my_password");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

$query = "SHOW SLAVE HOSTS";
$result = mysqli_query($link, $query);

/* get associative array */
while (($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) !== null) {
    print_r($row);
}

/* free result set */
mysqli_free_result($result);

/* close connection */
mysqli_close($link);
?>

I get the following output:

PHP Warning: mysqli_fetch_array(): Malformed server packet. Field length pointing 0 bytes after end of packet in /home/xxx/mysql_test on line 16
PHP Warning: mysqli_fetch_array(): Error while reading a row in /home/xxx/mysql_test on line 16
Array
(
    [Server_id] => 2
    [Host] => blacknas
    [Port] => 3306
    [Master_id] => 1
)

The PHP Warnings are the item i'm trying to get support with but I'm finding little out in the ether.

Nish Aravamudan (nacc) wrote :

Hello and thank you for filing this report.

I will probably SRU 7.0.17 early in the 17.10 cycle to the affected releases -- but this looks different than the bug I have seen in mysqli (and fixed in the version you have, as mentioned in the phpmyadmin bug). I have submitted a test build at: https://launchpad.net/~nacc/+archive/ubuntu/php7testbuilds for 7.0.17 for xenial. Please do no run this in production, but see if it resolves your issue.

If it does, we can look and see if a single upstream commit can be found that fixes it between 7.0.15 and 7.0.17.

If it doesn't, could you file a bug upstream (with PHP) and provide a link here? Sorry for making you chase down those leads.

Either re-mark this as New when you have a result!

Changed in php-defaults (Ubuntu):
status: New → Incomplete
affects: php-defaults (Ubuntu) → php7.0 (Ubuntu)

Hi Nish, so still have the same problem with 7.0.17. Have logged a bug with PHP here... https://bugs.php.net/bug.php?id=74320

Changed in php7.0 (Ubuntu):
status: Incomplete → New

On 27.03.2017 [22:00:47 -0000], Kelvin Middleton wrote:
> Hi Nish, so still have the same problem with 7.0.17. Have logged a bug
> with PHP here... https://bugs.php.net/bug.php?id=74320

Thank you for doing that!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.