|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-10-21 18:29 UTC] jim dot hofer at gmail dot com
Description: ------------ I'm using USE_ZEND_ALLOC=0 for some cli scripts due this bug https://bugs.php.net/bug.php?id=72736 When using USE_ZEND_ALLOC=0 and querying mysql with buffered queries on and the select query returns an empty result set the script exits with the message "Out of Memory" Setting the query to use unbuffered results in expected behavior. Also, not setting USE_ZEND_ALLOC=0 and querying unbuffered returns results in expected behavior This bug does not affect 7.0.11 Test script: --------------- <?php $mysqli = new mysqli("localhost", "root"); $result = $mysqli->query("SELECT * FROM mysql.user WHERE User = 'test'", MYSQLI_USE_RESULT)->fetch_all(); var_dump($result); $result = $mysqli->query("SELECT * FROM mysql.user WHERE User = 'test'")->fetch_all(); var_dump($result); Expected result: ---------------- array(0) { } array(0) { } Actual result: -------------- array(0) { } Out of memory PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
please try follow patch: diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 40eb100..5c9f124 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2850,7 +2850,9 @@ static ZEND_COLD ZEND_NORETURN void zend_out_of_memory(void) ZEND_API void * __zend_malloc(size_t len) { - void *tmp = malloc(len); + void *tmp; + len = MAX(len, 1); + tmp = malloc(len); if (EXPECTED(tmp)) { return tmp; } thanks