Merge branch 'PHP-7.1'

* PHP-7.1:
  Fixed bug #74547 mysqli::change_user() doesn't accept null as $database argument w/strict_types
This commit is contained in:
Anatol Belski 2017-05-06 15:11:06 +02:00
commit 703209f146
2 changed files with 26 additions and 1 deletions

View File

@ -619,7 +619,7 @@ PHP_FUNCTION(mysqli_change_user)
const CHARSET_INFO * old_charset;
#endif
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osss", &mysql_link, mysqli_link_class_entry, &user, &user_len, &password, &password_len, &dbname, &dbname_len) == FAILURE) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osss!", &mysql_link, mysqli_link_class_entry, &user, &user_len, &password, &password_len, &dbname, &dbname_len) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);

View File

@ -0,0 +1,25 @@
--TEST--
Bug #74547 mysqli::change_user() doesn't accept null as $database argument w/strict_types
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
declare(strict_types=1);
require_once("connect.inc");
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
var_dump(mysqli_change_user($link, $user, $passwd, NULL));
mysqli_close($link);
?>
===DONE===
--EXPECTF--
bool(true)
===DONE===