diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2015-09-01 18:38:11 +0200 |
---|---|---|
committer | Christoph M. Becker <cmb@php.net> | 2015-09-01 21:44:16 +0200 |
commit | b15eff63862c9ac24184b8121431019a352a42f8 (patch) | |
tree | 178f217c4adc5efed847210c64d89168c78c859a | |
parent | 50d6fd6a032aad352d0daa52540698131813a4ec (diff) | |
download | php-git-b15eff63862c9ac24184b8121431019a352a42f8.tar.gz |
Fix #32490: constructor of mysqli has wrong name
As of PHP 7 old style constructor names are deprecated, so we rename
mysqli::mysqli() to mysqli::__construct().
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/mysqli/mysqli_fe.c | 2 | ||||
-rw-r--r-- | ext/mysqli/tests/bug32490.phpt | 13 | ||||
-rw-r--r-- | ext/mysqli/tests/bug38003.phpt | 6 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_class_mysqli_interface.phpt | 2 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt | 130 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_connect_oo.phpt | 2 |
7 files changed, 86 insertions, 72 deletions
@@ -22,6 +22,9 @@ PHP NEWS . Fixed bug #70330 (Segmentation Fault with multiple "curl_copy_handle"). (Laruence) +- Mysqli: + . Fixed bug#32490 (constructor of mysqli has wrong name). (cmb) + - Pcntl: . Fixed bug #70386 (Can't compile on NetBSD because of missing WCONTINUED and WIFCONTINUED). (Matteo) diff --git a/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c index f69491f825..430175fc26 100644 --- a/ext/mysqli/mysqli_fe.c +++ b/ext/mysqli/mysqli_fe.c @@ -551,7 +551,7 @@ const zend_function_entry mysqli_link_methods[] = { PHP_FALIAS(init,mysqli_init_method, arginfo_mysqli_no_params) PHP_FALIAS(kill,mysqli_kill, arginfo_class_mysqli_kill) PHP_FALIAS(multi_query, mysqli_multi_query, arginfo_class_mysqli_query) - PHP_FALIAS(mysqli, mysqli_link_construct, arginfo_mysqli_connect) + PHP_FALIAS(__construct, mysqli_link_construct, arginfo_mysqli_connect) PHP_FALIAS(more_results, mysqli_more_results, arginfo_mysqli_no_params) PHP_FALIAS(next_result, mysqli_next_result, arginfo_mysqli_no_params) PHP_FALIAS(options, mysqli_options, arginfo_class_mysqli_options) diff --git a/ext/mysqli/tests/bug32490.phpt b/ext/mysqli/tests/bug32490.phpt new file mode 100644 index 0000000000..3d877c0d9c --- /dev/null +++ b/ext/mysqli/tests/bug32490.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #32490 (constructor of mysqli has wrong name) +--SKIPIF-- +<?php if (!extension_loaded("mysqli")) die("skip mysqli not available"); ?> +--FILE-- +<?php +var_dump(method_exists("mysqli", "mysqli")); +var_dump(method_exists("mysqli", "__construct")); +?> +--EXPECT-- +bool(false) +bool(true) + diff --git a/ext/mysqli/tests/bug38003.phpt b/ext/mysqli/tests/bug38003.phpt index a5f1a23bb5..f3a4823b9d 100644 --- a/ext/mysqli/tests/bug38003.phpt +++ b/ext/mysqli/tests/bug38003.phpt @@ -17,7 +17,5 @@ $DB = new DB(); echo "Done\n"; ?> --EXPECTF-- -Fatal error: Uncaught Error: Call to private DB::__construct() from invalid context in %s:%d -Stack trace: -#0 {main} - thrown in %s on line %d +Fatal error: Access level to DB::__construct() must be public (as in class mysqli) in %s%ebug38003.php on line %d + diff --git a/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt index ea86c198e7..c816163e13 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt @@ -19,6 +19,7 @@ require_once('skipifconnectfailure.inc'); printf("\nMethods:\n"); $methods = get_class_methods($mysqli); $expected_methods = array( + '__construct' => true, 'autocommit' => true, 'begin_transaction' => true, 'change_user' => true, @@ -36,7 +37,6 @@ require_once('skipifconnectfailure.inc'); 'kill' => true, 'more_results' => true, 'multi_query' => true, - 'mysqli' => true, 'next_result' => true, 'options' => true, 'ping' => true, diff --git a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt index 8f6c24900a..22829ee6ee 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt @@ -37,7 +37,7 @@ Modifiers: '0' Parent Class: '' Extension: 'mysqli' -Inspecting method 'mysqli' +Inspecting method '__construct' isFinal: no isAbstract: no isPublic: yes @@ -53,42 +53,100 @@ Modifiers: 8448 Number of Parameters: 6 Number of Required Parameters: 0 -Inspecting parameter 'host' of method 'mysqli' +Inspecting parameter 'host' of method '__construct' isArray: no allowsNull: no isPassedByReference: no isOptional: yes isDefaultValueAvailable: no -Inspecting parameter 'user' of method 'mysqli' +Inspecting parameter 'user' of method '__construct' isArray: no allowsNull: no isPassedByReference: no isOptional: yes isDefaultValueAvailable: no -Inspecting parameter 'password' of method 'mysqli' +Inspecting parameter 'password' of method '__construct' isArray: no allowsNull: no isPassedByReference: no isOptional: yes isDefaultValueAvailable: no -Inspecting parameter 'database' of method 'mysqli' +Inspecting parameter 'database' of method '__construct' isArray: no allowsNull: no isPassedByReference: no isOptional: yes isDefaultValueAvailable: no -Inspecting parameter 'port' of method 'mysqli' +Inspecting parameter 'port' of method '__construct' isArray: no allowsNull: no isPassedByReference: no isOptional: yes isDefaultValueAvailable: no -Inspecting parameter 'socket' of method 'mysqli' +Inspecting parameter 'socket' of method '__construct' +isArray: no +allowsNull: no +isPassedByReference: no +isOptional: yes +isDefaultValueAvailable: no + +Inspecting method '__construct' +isFinal: no +isAbstract: no +isPublic: yes +isPrivate: no +isProtected: no +isStatic: no +isConstructor: yes +isDestructor: no +isInternal: yes +isUserDefined: no +returnsReference: no +Modifiers: 8448 +Number of Parameters: 6 +Number of Required Parameters: 0 + +Inspecting parameter 'host' of method '__construct' +isArray: no +allowsNull: no +isPassedByReference: no +isOptional: yes +isDefaultValueAvailable: no + +Inspecting parameter 'user' of method '__construct' +isArray: no +allowsNull: no +isPassedByReference: no +isOptional: yes +isDefaultValueAvailable: no + +Inspecting parameter 'password' of method '__construct' +isArray: no +allowsNull: no +isPassedByReference: no +isOptional: yes +isDefaultValueAvailable: no + +Inspecting parameter 'database' of method '__construct' +isArray: no +allowsNull: no +isPassedByReference: no +isOptional: yes +isDefaultValueAvailable: no + +Inspecting parameter 'port' of method '__construct' +isArray: no +allowsNull: no +isPassedByReference: no +isOptional: yes +isDefaultValueAvailable: no + +Inspecting parameter 'socket' of method '__construct' isArray: no allowsNull: no isPassedByReference: no @@ -525,64 +583,6 @@ isPassedByReference: no isOptional: no isDefaultValueAvailable: no -Inspecting method 'mysqli' -isFinal: no -isAbstract: no -isPublic: yes -isPrivate: no -isProtected: no -isStatic: no -isConstructor: yes -isDestructor: no -isInternal: yes -isUserDefined: no -returnsReference: no -Modifiers: 8448 -Number of Parameters: 6 -Number of Required Parameters: 0 - -Inspecting parameter 'host' of method 'mysqli' -isArray: no -allowsNull: no -isPassedByReference: no -isOptional: yes -isDefaultValueAvailable: no - -Inspecting parameter 'user' of method 'mysqli' -isArray: no -allowsNull: no -isPassedByReference: no -isOptional: yes -isDefaultValueAvailable: no - -Inspecting parameter 'password' of method 'mysqli' -isArray: no -allowsNull: no -isPassedByReference: no -isOptional: yes -isDefaultValueAvailable: no - -Inspecting parameter 'database' of method 'mysqli' -isArray: no -allowsNull: no -isPassedByReference: no -isOptional: yes -isDefaultValueAvailable: no - -Inspecting parameter 'port' of method 'mysqli' -isArray: no -allowsNull: no -isPassedByReference: no -isOptional: yes -isDefaultValueAvailable: no - -Inspecting parameter 'socket' of method 'mysqli' -isArray: no -allowsNull: no -isPassedByReference: no -isOptional: yes -isDefaultValueAvailable: no - Inspecting method 'next_result' isFinal: no isAbstract: no diff --git a/ext/mysqli/tests/mysqli_connect_oo.phpt b/ext/mysqli/tests/mysqli_connect_oo.phpt index 35cc116164..32dfac0eb2 100644 --- a/ext/mysqli/tests/mysqli_connect_oo.phpt +++ b/ext/mysqli/tests/mysqli_connect_oo.phpt @@ -147,7 +147,7 @@ require_once('skipifconnectfailure.inc'); print "done!"; ?> --EXPECTF-- -Warning: mysqli::mysqli(): (%s/%d): Access denied for user '%sunknown%s'@'%s' (using password: %s) in %s on line %d +Warning: mysqli::__construct(): (%s/%d): Access denied for user '%sunknown%s'@'%s' (using password: %s) in %s on line %d ... and now Exceptions Access denied for user '%s'@'%s' (using password: %s) done!
\ No newline at end of file |