mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed bug #67348: Reading $dbc->stat modifies $dbc->affected_rows
This commit is contained in:
parent
152ccfb08d
commit
579562176b
11 changed files with 6 additions and 87 deletions
4
NEWS
4
NEWS
|
@ -15,6 +15,10 @@ PHP NEWS
|
|||
- GD:
|
||||
. Added TGA read support. (cmb)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #67348 (Reading $dbc->stat modifies $dbc->affected_rows).
|
||||
(Derick)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug #78106 (Path resolution fails if opcache disabled during request).
|
||||
(Nikita)
|
||||
|
|
|
@ -634,7 +634,6 @@ PHP_MINIT_FUNCTION(mysqli)
|
|||
zend_declare_property_null(ce, "insert_id", sizeof("insert_id") - 1, ZEND_ACC_PUBLIC);
|
||||
zend_declare_property_null(ce, "server_info", sizeof("server_info") - 1, ZEND_ACC_PUBLIC);
|
||||
zend_declare_property_null(ce, "server_version", sizeof("server_version") - 1, ZEND_ACC_PUBLIC);
|
||||
zend_declare_property_null(ce, "stat", sizeof("stat") - 1, ZEND_ACC_PUBLIC);
|
||||
zend_declare_property_null(ce, "sqlstate", sizeof("sqlstate") - 1, ZEND_ACC_PUBLIC);
|
||||
zend_declare_property_null(ce, "protocol_version", sizeof("protocol_version") - 1, ZEND_ACC_PUBLIC);
|
||||
zend_declare_property_null(ce, "thread_id", sizeof("thread_id") - 1, ZEND_ACC_PUBLIC);
|
||||
|
|
|
@ -234,38 +234,6 @@ MYSQLI_MAP_PROPERTY_FUNC_STRING(link_sqlstate_read, mysql_sqlstate, MYSQLI_GET_M
|
|||
MYSQLI_MAP_PROPERTY_FUNC_LONG(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
|
||||
MYSQLI_MAP_PROPERTY_FUNC_LONG(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
|
||||
|
||||
/* {{{ property link_stat_read */
|
||||
static zval *link_stat_read(mysqli_object *obj, zval *retval)
|
||||
{
|
||||
MY_MYSQL *mysql;
|
||||
|
||||
ZVAL_NULL(retval);
|
||||
|
||||
#if defined(MYSQLI_USE_MYSQLND)
|
||||
CHECK_STATUS(MYSQLI_STATUS_INITIALIZED);
|
||||
#else
|
||||
CHECK_STATUS(MYSQLI_STATUS_VALID);
|
||||
#endif
|
||||
|
||||
mysql = (MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
|
||||
|
||||
if (mysql) {
|
||||
#if defined(MYSQLI_USE_MYSQLND)
|
||||
zend_string * stat_msg;
|
||||
if (mysqlnd_stat(mysql->mysql, &stat_msg) == PASS) {
|
||||
ZVAL_STR(retval, stat_msg);
|
||||
}
|
||||
#else
|
||||
char * stat_msg;
|
||||
if ((stat_msg = (char *)mysql_stat(mysql->mysql))) {
|
||||
ZVAL_STRING(retval, stat_msg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* result properties */
|
||||
|
||||
/* {{{ property result_type_read */
|
||||
|
@ -435,7 +403,6 @@ const mysqli_property_entry mysqli_link_property_entries[] = {
|
|||
{"insert_id", sizeof("insert_id") - 1, link_insert_id_read, NULL},
|
||||
{"server_info", sizeof("server_info") - 1, link_server_info_read, NULL},
|
||||
{"server_version", sizeof("server_version") - 1, link_server_version_read, NULL},
|
||||
{"stat", sizeof("stat") - 1, link_stat_read, NULL},
|
||||
{"sqlstate", sizeof("sqlstate") - 1, link_sqlstate_read, NULL},
|
||||
{"protocol_version",sizeof("protocol_version") - 1, link_protocol_version_read, NULL},
|
||||
{"thread_id", sizeof("thread_id") - 1, link_thread_id_read, NULL},
|
||||
|
|
|
@ -92,8 +92,6 @@ object(mysqli)#%d (%d) {
|
|||
string(%d) "%s"
|
||||
["server_version"]=>
|
||||
int(%d)
|
||||
["stat"]=>
|
||||
string(%d) "Uptime: %d Threads: %d Questions: %d Slow queries: %d Opens: %d Flush tables: %d Open tables: %d Queries per second avg: %d.%d"
|
||||
["sqlstate"]=>
|
||||
string(5) "00000"
|
||||
["protocol_version"]=>
|
||||
|
@ -132,8 +130,6 @@ object(mysqli)#%d (%d) {
|
|||
bool(false)
|
||||
["server_version"]=>
|
||||
bool(false)
|
||||
["stat"]=>
|
||||
NULL
|
||||
["sqlstate"]=>
|
||||
bool(false)
|
||||
["protocol_version"]=>
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
--TEST--
|
||||
Bug #55859 mysqli->stat property access gives error
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
|
||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||
}
|
||||
var_dump(soundex(mysqli_stat($link)) === soundex($link->stat));
|
||||
echo "done!";
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
done!
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/*
|
||||
Default values are "localhost", "root",
|
||||
database "stest" and empty password.
|
||||
database "test" and empty password.
|
||||
Change the MYSQL_TEST environment values
|
||||
if you want to use another configuration
|
||||
*/
|
||||
|
|
|
@ -53,7 +53,7 @@ require_once('skipifconnectfailure.inc');
|
|||
'set_charset' => true,
|
||||
'set_opt' => true,
|
||||
'ssl_set' => true,
|
||||
'stat' => true,
|
||||
'stat' => true,
|
||||
'stmt_init' => true,
|
||||
'store_result' => true,
|
||||
'thread_safe' => true,
|
||||
|
@ -109,7 +109,6 @@ require_once('skipifconnectfailure.inc');
|
|||
"server_info" => true,
|
||||
"server_version" => true,
|
||||
"sqlstate" => true,
|
||||
"stat" => true,
|
||||
"thread_id" => true,
|
||||
"warning_count" => true,
|
||||
);
|
||||
|
@ -200,11 +199,6 @@ require_once('skipifconnectfailure.inc');
|
|||
$mysqli->sqlstate, gettype($mysqli->sqlstate),
|
||||
mysqli_sqlstate($link), gettype(mysqli_sqlstate($link)));
|
||||
|
||||
assert(soundex(mysqli_stat($link)) == soundex($mysqli->stat));
|
||||
printf("mysqli->stat = '%s'/%s ('%s'/%s)\n",
|
||||
$mysqli->stat, gettype($mysqli->stat),
|
||||
mysqli_stat($link), gettype(mysqli_stat($link)));
|
||||
|
||||
assert(mysqli_get_host_info($link) === $mysqli->host_info);
|
||||
printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n",
|
||||
$mysqli->host_info, gettype($mysqli->host_info),
|
||||
|
@ -288,7 +282,6 @@ mysqli->error = ''/string (''/string)
|
|||
mysqli->field_count = '0'/integer ('0'/integer)
|
||||
mysqli->insert_id = '0'/integer ('0'/integer)
|
||||
mysqli->sqlstate = '00000'/string ('00000'/string)
|
||||
mysqli->stat = 'Uptime: %d Threads: %d Questions: %d Slow queries: %d Opens: %d Flush tables: %d Open tables: %d Queries per second avg: %d.%d'/string ('Uptime: %d Threads: %d Questions: %d Slow queries: %d Opens: %d Flush tables: %d Open tables: %d Queries per second avg: %d.%d'/string)
|
||||
mysqli->host_info = '%s'/string ('%s'/string)
|
||||
mysqli->info = ''/NULL (''/NULL)
|
||||
mysqli->thread_id = '%d'/integer ('%d'/integer)
|
||||
|
|
|
@ -160,7 +160,6 @@ protocol_version = 'false'
|
|||
server_info = 'false'
|
||||
server_version = 'false'
|
||||
sqlstate = 'false'
|
||||
stat = 'false'
|
||||
thread_id = 'false'
|
||||
warning_count = 'false'
|
||||
|
||||
|
@ -179,7 +178,6 @@ info = 'false'
|
|||
insert_id = 'false'
|
||||
server_info = 'false'
|
||||
server_version = 'false'
|
||||
stat = 'false'
|
||||
sqlstate = 'false'
|
||||
protocol_version = 'false'
|
||||
thread_id = 'false'
|
||||
|
@ -233,7 +231,6 @@ protocol_version = 'false'
|
|||
server_info = 'false'
|
||||
server_version = 'false'
|
||||
sqlstate = 'false'
|
||||
stat = 'false'
|
||||
thread_id = 'false'
|
||||
warning_count = 'false'
|
||||
|
||||
|
@ -252,7 +249,6 @@ info = 'false'
|
|||
insert_id = 'false'
|
||||
server_info = 'false'
|
||||
server_version = 'false'
|
||||
stat = 'false'
|
||||
sqlstate = 'false'
|
||||
protocol_version = 'false'
|
||||
thread_id = 'false'
|
||||
|
|
|
@ -1317,14 +1317,6 @@ isStatic: no
|
|||
isDefault: yes
|
||||
Modifiers: 1
|
||||
|
||||
Inspecting property 'stat'
|
||||
isPublic: yes
|
||||
isPrivate: no
|
||||
isProtected: no
|
||||
isStatic: no
|
||||
isDefault: yes
|
||||
Modifiers: 1
|
||||
|
||||
Inspecting property 'thread_id'
|
||||
isPublic: yes
|
||||
isPrivate: no
|
||||
|
@ -1356,7 +1348,6 @@ Default property 'protocol_version'
|
|||
Default property 'server_info'
|
||||
Default property 'server_version'
|
||||
Default property 'sqlstate'
|
||||
Default property 'stat'
|
||||
Default property 'thread_id'
|
||||
Default property 'warning_count'
|
||||
done!
|
||||
|
|
|
@ -44,9 +44,6 @@ require_once('skipifconnectfailure.inc');
|
|||
if ($link->info != 'Records: 6 Duplicates: 0 Warnings: 0') {
|
||||
printf("[008] mysqlnd used to be more verbose and used to support SELECT\n");
|
||||
}
|
||||
if ($link->stat != NULL) {
|
||||
printf("[009] NULL expected because of error.\n");
|
||||
}
|
||||
} else {
|
||||
if ($link->info != NULL) {
|
||||
printf("[008] Time for wonders - libmysql has started to support SELECT, change test\n");
|
||||
|
@ -123,8 +120,6 @@ object(mysqli)#%d (%d) {
|
|||
string(%d) "%s"
|
||||
["server_version"]=>
|
||||
int(%d)
|
||||
["stat"]=>
|
||||
%s
|
||||
["sqlstate"]=>
|
||||
string(5) "HY000"
|
||||
["protocol_version"]=>
|
||||
|
|
|
@ -207,8 +207,6 @@ object(mysqli)#%d (%d) {
|
|||
bool(false)
|
||||
["server_version"]=>
|
||||
bool(false)
|
||||
["stat"]=>
|
||||
bool(false)
|
||||
["sqlstate"]=>
|
||||
bool(false)
|
||||
["protocol_version"]=>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue