Bug #73949 [Com]: memory leaks detected
Edit report at https://bugs.php.net/bug.php?id=73949&edit=1
ID: 73949
Comment by: shan dot liu at msn dot com
Reported by: shan dot liu at msn dot com
Summary: memory leaks detected
Status: Open
Type: Bug
Package: MySQLi related
PHP Version: 7.1.0
Block user comment: N
Private report: N
New Comment:
mysqli.c line 1294:
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
if (zend_fcall_info_args(&fci, ctor_params) == FAILURE) {
/* Two problems why we throw exceptions here: PHP is typeless
* and hence passing one argument that's not an array could be
* by mistake and the other way round is possible, too. The
* single value is an array. Also we'd have to make that one
* argument passed by reference.
*/
zend_throw_exception(zend_ce_exception, "Parameter ctor_params must be an array", 0);
return;
}
}
change to:
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
if (zend_fcall_info_args(&fci, ctor_params) == FAILURE) {
/* Two problems why we throw exceptions here: PHP is typeless
* and hence passing one argument that's not an array could be
* by mistake and the other way round is possible, too. The
* single value is an array. Also we'd have to make that one
* argument passed by reference.
*/
zend_throw_exception(zend_ce_exception, "Parameter ctor_params must be an array", 0);
return;
}
zend_refcounted *_gc = Z_COUNTED_P(fci.params);
GC_REFCOUNT(_gc)--;
}
Previous Comments:
------------------------------------------------------------------------
[2017-01-16 16:22:10] shan dot liu at msn dot com
Description:
------------
[Tue Jan 17 00:15:57 2017] Script: '/home/lonely/workspace/ldb/dome/t.php'
/opt/php7/src/Zend/zend_string.h(0) : Freeing 0x7FA2B387B2C0 (32 bytes),
script=/home/lonely/workspace/ldb/dome/t.php
=== Total 1 memory leaks detected ===
Test script:
---------------
<?php
class cc{
function __construct($c=null){
}
};
$i=mysqli_connect("127.0.0.1",'root','110','test_db');
$res=mysqli_query($i,'select * from l_order limit 1');
$t=array('-');
while($db= mysqli_fetch_object($res,'cc',$t)){}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73949&edit=1
Thread (4 messages)