Skip to content

Commit 5bc8162

Browse files
committed
Merge branch 'PHP-7.1'
* PHP-7.1: Fix bug #73949 leak in mysqli_fetch_object
2 parents 409467d + 6d89640 commit 5bc8162

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ PHP NEWS
7070
- Mcrypt:
7171
. The deprecated mcrypt extension has been moved to PECL. (leigh)
7272

73+
- MySQLi:
74+
. Fixed bug #73949 (leak in mysqli_fetch_object). (krakjoe)
75+
7376
- mysqlnd:
7477
. Fixed bug #73800 (sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE).
7578
(vanviegen)

ext/mysqli/mysqli.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,9 +1318,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
13181318
} else {
13191319
zval_ptr_dtor(&retval);
13201320
}
1321-
if (fci.params) {
1322-
efree(fci.params);
1323-
}
1321+
zend_fcall_info_args_clear(&fci, 1);
13241322
} else if (ctor_params) {
13251323
zend_throw_exception_ex(zend_ce_exception, 0, "Class %s does not have a constructor hence you cannot use ctor_params", ZSTR_VAL(ce->name));
13261324
}

ext/mysqli/tests/bug73949.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Bug #73949 (leak in mysqli_fetch_object)
3+
--SKIPIF--
4+
<?php
5+
require_once('skipif.inc');
6+
require_once('skipifemb.inc');
7+
require_once('skipifconnectfailure.inc');
8+
?>
9+
--FILE--
10+
<?php
11+
require_once("connect.inc");
12+
13+
class cc{
14+
function __construct($c=null){
15+
}
16+
};
17+
$i=mysqli_connect('p:'.$host, $user, $passwd, $db);
18+
$res=mysqli_query($i, "SHOW STATUS LIKE 'Connections'");
19+
$t=array(new stdClass);
20+
while($db= mysqli_fetch_object($res,'cc',$t)){}
21+
print "done!";
22+
?>
23+
--EXPECTF--
24+
done!

0 commit comments

Comments
 (0)