amphp / mysql

An async MySQL client for PHP, optimizing database interactions with efficient non-blocking capabilities. Perfect for responsive, high-performance applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Infinite recursion when iterating

danog opened this issue · comments

This code causes infinite recursion:

<?php declare(strict_types=1);

require 'vendor/autoload.php';

$config = Amp\Mysql\MysqlConfig::fromString(
    "host=127.0.0.1 user=daniil db=test"
);

$pool = new Amp\Mysql\MysqlConnectionPool($config);

foreach ($pool->execute("SELECT * FROM 6565201688_MTProto_chats") as $result) {
    var_dump($result);
}

With mariadb from 11.2.2-MariaDB, client 15.2 for Linux (x86_64) using readline 5.1

The culprit seems to be amphp/sql-common@de27f1c

The issue seems to be yield from here. Swapping that to foreach ($result as $row) yield $row fixes the segfault. Seems we found a PHP bug, though I'm not sure how to repo it in isolation.

commented

OK, but we really need to reproduce it 😞