mirror of
https://github.com/php/php-src.git
synced 2024-09-25 11:57:26 +00:00
Merge remote-tracking branch 'origin/master'
* origin/master: Add test for ReflectionMethod::getPrototype_basic() Added two tests to check the main functionallity of recode extension Doubles are not refcounted Fix #32490: constructor of mysqli has wrong name
This commit is contained in:
commit
c18f662e3c
2
.gdbinit
2
.gdbinit
@ -152,7 +152,7 @@ define ____printzv_contents
|
||||
set $type = $zvalue->u1.v.type
|
||||
|
||||
# 15 == IS_INDIRECT
|
||||
if $type >= 5 && $type != 15
|
||||
if $type > 5 && $type != 15
|
||||
printf "(refcount=%d) ", $zvalue->value.counted->gc.refcount
|
||||
end
|
||||
|
||||
|
3
NEWS
3
NEWS
@ -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)
|
||||
|
@ -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)
|
||||
|
13
ext/mysqli/tests/bug32490.phpt
Normal file
13
ext/mysqli/tests/bug32490.phpt
Normal file
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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!
|
38
ext/recode/tests/001.phpt
Normal file
38
ext/recode/tests/001.phpt
Normal file
@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
recode_string() function - Testing string conversions between latin1, UTF-8 and html
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("recode")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function ascii2hex($ascii) {
|
||||
$hex = '';
|
||||
for ($i = 0; $i < strlen($ascii); $i++) {
|
||||
$byte = dechex(ord($ascii{$i}));
|
||||
$byte = str_repeat('0', 2 - strlen($byte)).$byte;
|
||||
$hex .= $byte . " ";
|
||||
}
|
||||
return $hex;
|
||||
}
|
||||
|
||||
function hex2ascii($hex){
|
||||
$ascii='';
|
||||
$hex=str_replace(" ", "", $hex);
|
||||
for($i=0; $i<strlen($hex); $i=$i+2) {
|
||||
$ascii .= chr(hexdec(substr($hex, $i, 2)));
|
||||
}
|
||||
return($ascii);
|
||||
}
|
||||
|
||||
$lat1_hex_org = '31 32 33 e5 e4 f6 61 62 63';
|
||||
$utf8_hex = ascii2hex(recode_string('lat1..utf-8', hex2ascii($lat1_hex_org)));
|
||||
$html = recode_string('utf-8..html', hex2ascii($utf8_hex));
|
||||
$lat1_hex = ascii2hex(recode_string('html..lat1', $html));
|
||||
|
||||
echo "#" . $utf8_hex . "#\n";
|
||||
echo "#" . $html . "#\n";
|
||||
echo "#" . $lat1_hex . "#\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
#31 32 33 c3 a5 c3 a4 c3 b6 61 62 63 #
|
||||
#123åäöabc#
|
||||
#31 32 33 e5 e4 f6 61 62 63 #
|
32
ext/recode/tests/002.phpt
Normal file
32
ext/recode/tests/002.phpt
Normal file
@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
recode_string() function - Testing string conversions between latin1, UTF-8 and html
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("recode")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function ascii2hex($ascii) {
|
||||
$hex = '';
|
||||
for ($i = 0; $i < strlen($ascii); $i++) {
|
||||
$byte = dechex(ord($ascii{$i}));
|
||||
$byte = str_repeat('0', 2 - strlen($byte)).$byte;
|
||||
$hex .= $byte . " ";
|
||||
}
|
||||
return $hex;
|
||||
}
|
||||
|
||||
$html_file = fopen(realpath(dirname(__FILE__)) . '/html.raw', 'r');
|
||||
$utf_8_filepath = realpath(dirname(__FILE__)) . '/utf8.raw';
|
||||
$utf_8_file = fopen($utf_8_filepath, 'w+');
|
||||
|
||||
recode_file('html..utf8', $html_file, $utf_8_file);
|
||||
|
||||
rewind($utf_8_file);
|
||||
echo '#' . ascii2hex(fread($utf_8_file, filesize($utf_8_filepath))) . "#\n";
|
||||
|
||||
fclose($html_file);
|
||||
fclose($utf_8_file);
|
||||
|
||||
unlink($utf_8_filepath);
|
||||
?>
|
||||
--EXPECT--
|
||||
#31 32 33 c3 a5 c3 a4 c3 b6 61 62 63 #
|
1
ext/recode/tests/html.raw
Normal file
1
ext/recode/tests/html.raw
Normal file
@ -0,0 +1 @@
|
||||
123åäöabc
|
@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
public ReflectionMethod ReflectionMethod::getPrototype ( void );
|
||||
--CREDITS--
|
||||
marcosptf - <marcosptf@yahoo.com.br>
|
||||
--FILE--
|
||||
<?php
|
||||
class Hello {
|
||||
public function sayHelloTo($name) {
|
||||
return 'Hello ' . $name;
|
||||
}
|
||||
}
|
||||
|
||||
class HelloWorld extends Hello {
|
||||
public function sayHelloTo($name) {
|
||||
return 'Hello world: ' . $name;
|
||||
}
|
||||
}
|
||||
|
||||
$reflectionMethod = new ReflectionMethod('HelloWorld', 'sayHelloTo');
|
||||
var_dump($reflectionMethod->getPrototype());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(ReflectionMethod)#2 (2) {
|
||||
["name"]=>
|
||||
string(10) "sayHelloTo"
|
||||
["class"]=>
|
||||
string(5) "Hello"
|
||||
}
|
Loading…
Reference in New Issue
Block a user