From c044164a96553668cc6c4ae1eb32f18219308851 Mon Sep 17 00:00:00 2001 From: Keyur Govande Date: Thu, 14 Aug 2014 18:19:56 +0000 Subject: [PATCH 01/15] Patch for bug #67839 (mysqli does not handle 4-byte floats correctly) Before the patch, a value of 9.99 in a FLOAT column came out of mysqli as 9.9998998641968. This is because it would naively cast a 4-byte float into PHP's internal 8-byte double. To fix this, with GCC we use the built-in decimal support to "up-convert" the 4-byte float to a 8-byte double. When that is not available, we fall back to converting the float to a string and then converting the string to a double. This mimics what MySQL does. --- ext/mysqli/tests/bug67839.phpt | 58 ++++++++++++++++++++++++++++++++++ ext/mysqlnd/config9.m4 | 26 +++++++++++++++ ext/mysqlnd/mysqlnd_ps_codec.c | 49 +++++++++++++++++++++++++--- 3 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 ext/mysqli/tests/bug67839.phpt diff --git a/ext/mysqli/tests/bug67839.phpt b/ext/mysqli/tests/bug67839.phpt new file mode 100644 index 00000000000..b2821a21bc2 --- /dev/null +++ b/ext/mysqli/tests/bug67839.phpt @@ -0,0 +1,58 @@ +--TEST-- +mysqli_float_handling - ensure 4 byte float is handled correctly +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +1: 9.9999: 9.9999 diff --git a/ext/mysqlnd/config9.m4 b/ext/mysqlnd/config9.m4 index 2c15c34e8d3..d730ba7e71f 100644 --- a/ext/mysqlnd/config9.m4 +++ b/ext/mysqlnd/config9.m4 @@ -51,3 +51,29 @@ if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes" || test "$ #endif ]) fi + +dnl +dnl Check if the compiler supports Decimal32/64/128 types from the IEEE-754 2008 version +dnl References: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1657.pdf +dnl http://speleotrove.com/decimal/ +dnl +AC_CACHE_CHECK([whether whether compiler supports Decimal32/64/128 types], ac_cv_decimal_fp_supported,[ +AC_TRY_RUN( [ +#include + +int main(int argc, char **argv) { + typedef float dec32 __attribute__((mode(SD))); + dec32 k = 99.49f; + double d2 = (double)k; + return 0; +} +],[ + ac_cv_decimal_fp_supported=yes +],[ + ac_cv_decimal_fp_supported=no +],[ + ac_cv_decimal_fp_supported=no +])]) +if test "$ac_cv_decimal_fp_supported" = "yes"; then + AC_DEFINE(HAVE_DECIMAL_FP_SUPPORT, 1, [Define if the compiler supports Decimal32/64/128 types.]) +fi diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index e2640c775ba..3f7d31002f6 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -195,12 +195,53 @@ void ps_fetch_float(zval *zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar **row, zend_bool as_unicode TSRMLS_DC) { - float value; + float fval; + double dval; DBG_ENTER("ps_fetch_float"); - float4get(value, *row); - ZVAL_DOUBLE(zv, value); + float4get(fval, *row); (*row)+= 4; - DBG_INF_FMT("value=%f", value); + DBG_INF_FMT("value=%f", fval); + + /* + * The following is needed to correctly support 4-byte floats. + * Otherwise, a value of 9.99 in a FLOAT column comes out of mysqli + * as 9.9998998641968. + * + * For GCC, we use the built-in decimal support to "up-convert" a + * 4-byte float to a 8-byte double. + * When that is not available, we fall back to converting the float + * to a string and then converting the string to a double. This mimics + * what MySQL does. + */ +#ifdef HAVE_DECIMAL_FP_SUPPORT + { + typedef float dec32 __attribute__((mode(SD))); + dec32 d32val = fval; + + /* The following cast is guaranteed to do the right thing */ + dval = (double) d32val; + } +#else + { + char num_buf[2048]; /* Over allocated */ + char *s; + + /* Convert to string. Ignoring localization, etc. + * Following MySQL's rules. If precision is undefined (NOT_FIXED_DEC i.e. 31) + * or larger than 31, the value is limited to 6 (FLT_DIG). + */ + s = php_gcvt(fval, + field->decimals >= 31 ? 6 : field->decimals, + '.', + 'e', + num_buf); + + /* And now convert back to double */ + dval = zend_strtod(s, NULL); + } +#endif + + ZVAL_DOUBLE(zv, dval); DBG_VOID_RETURN; } /* }}} */ From 4e2c01617f207c039881f635d3beb77eff0d9669 Mon Sep 17 00:00:00 2001 From: Keyur Govande Date: Thu, 14 Aug 2014 18:20:26 +0000 Subject: [PATCH 02/15] Fix failing tests --- ext/mysqli/tests/010.phpt | 12 ++++++------ ext/mysqli/tests/011.phpt | 4 ++-- ext/mysqli/tests/012.phpt | 4 ++-- ext/mysqli/tests/mysqli_change_user.phpt | 7 ++++++- ext/mysqli/tests/mysqli_change_user_oo.phpt | 7 ++++++- ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt | 2 +- ext/mysqli/tests/table.inc | 7 ++++++- 7 files changed, 29 insertions(+), 14 deletions(-) diff --git a/ext/mysqli/tests/010.phpt b/ext/mysqli/tests/010.phpt index 60ff8eac19b..83a43e06b67 100644 --- a/ext/mysqli/tests/010.phpt +++ b/ext/mysqli/tests/010.phpt @@ -62,18 +62,18 @@ mysqli_close($link); --EXPECT-- array(7) { [0]=> - float(3.14159274101) + float(3.141593) [1]=> - float(-9.99999997475E-7) + float(-1.0E-6) [2]=> float(0) [3]=> - float(999999995904) + float(1.0E+12) [4]=> - float(0.564642488956) + float(0.5646425) [5]=> float(1) [6]=> - float(8.88888914608E+14) + float(8.888889E+14) } -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/011.phpt b/ext/mysqli/tests/011.phpt index db03abac83f..b14516ff781 100644 --- a/ext/mysqli/tests/011.phpt +++ b/ext/mysqli/tests/011.phpt @@ -67,7 +67,7 @@ array(8) { [3]=> int(4999999) [4]=> - float(2345.60009766) + float(2345.6) [5]=> float(5678.89563) [6]=> @@ -75,4 +75,4 @@ array(8) { [7]=> %unicode|string%(11) "mysql rulez" } -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/012.phpt b/ext/mysqli/tests/012.phpt index 7cc34b0c00e..91abae48506 100644 --- a/ext/mysqli/tests/012.phpt +++ b/ext/mysqli/tests/012.phpt @@ -66,7 +66,7 @@ array(8) { [3]=> int(54) [4]=> - float(2.59999990463) + float(2.6) [5]=> float(58.89) [6]=> @@ -74,4 +74,4 @@ array(8) { [7]=> %unicode|string%(3) "6.7" } -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_change_user.phpt b/ext/mysqli/tests/mysqli_change_user.phpt index bfea423c9e4..3bfb9ebf7d1 100644 --- a/ext/mysqli/tests/mysqli_change_user.phpt +++ b/ext/mysqli/tests/mysqli_change_user.phpt @@ -41,6 +41,11 @@ require_once('skipifconnectfailure.inc'); if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really'))) printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + // Reconnect because after 3 failed change_user attempts, the server blocks you off. + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1')) printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -109,4 +114,4 @@ require_once('skipifconnectfailure.inc'); print "done!"; ?> --EXPECTF-- -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_change_user_oo.phpt b/ext/mysqli/tests/mysqli_change_user_oo.phpt index 61444ae2350..96c8a698bb6 100644 --- a/ext/mysqli/tests/mysqli_change_user_oo.phpt +++ b/ext/mysqli/tests/mysqli_change_user_oo.phpt @@ -43,6 +43,11 @@ if (!$IS_MYSQLND && (mysqli_get_server_version($link) < 50118 && mysqli_get_serv if (false !== ($tmp = $mysqli->change_user($user, $passwd, $db . '_unknown_really'))) printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + // Reconnect because after 3 failed change_user attempts, the server blocks you off. + if (!$mysqli = new my_mysqli($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); + if (!$mysqli->query('SET @mysqli_change_user_test_var=1')) printf("[009] Failed to set test variable: [%d] %s\n", $mysqli->errno, $mysqli->error); @@ -81,4 +86,4 @@ if (!$IS_MYSQLND && (mysqli_get_server_version($link) < 50118 && mysqli_get_serv print "done!"; ?> --EXPECTF-- -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt b/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt index 2fd1121a76a..991d3c345b1 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt @@ -36,7 +36,7 @@ $port, $socket, mysqli_connect_errno(), mysqli_connect_error()); mysqli_error($link)); } - if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY + if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(3), PRIMARY KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=gbk")) { printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/table.inc b/ext/mysqli/tests/table.inc index aa1207af444..ec360c8f2cf 100644 --- a/ext/mysqli/tests/table.inc +++ b/ext/mysqli/tests/table.inc @@ -12,6 +12,11 @@ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { exit(1); } +if (!mysqli_query($link, 'SET SESSION sql_mode=\'\'')) { + printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + exit(1); +} + if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) { printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); exit(1); @@ -20,4 +25,4 @@ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(i if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')")) { printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); } -?> \ No newline at end of file +?> From 617b1759c4f0e3160bdfcc346ee668e9dda2fad8 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 15 Aug 2014 18:38:31 +0800 Subject: [PATCH 03/15] Better version checking --- ext/phar/phar_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 3d403fff576..74f06e71dd2 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -30,7 +30,7 @@ static zend_class_entry *phar_ce_PharException; static zend_class_entry *phar_ce_entry; #endif -#if PHP_MAJOR_VERSION > 5 || ((PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION >= 3)) +#if PHP_VERSION_ID >= 53000 # define PHAR_ARG_INFO #else # define PHAR_ARG_INFO static From 7af24dcb474fbc92a324e1c939ab0ac7a5c65346 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 15 Aug 2014 18:39:45 +0800 Subject: [PATCH 04/15] Better version checking --- ext/intl/collator/collator_convert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index 1d8681582c3..e64bf880b09 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -28,7 +28,7 @@ #include #include -#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION <= 1) +#if PHP_VERSION_ID <= 51000 #define CAST_OBJECT_SHOULD_FREE ,0 #else #define CAST_OBJECT_SHOULD_FREE From bde56debe56ea0df1556f4aa9b596c7123e80445 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 15 Aug 2014 18:41:01 +0800 Subject: [PATCH 05/15] Better version checking --- ext/pdo/pdo_dbh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index b2904118e8e..28e26083abc 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1412,7 +1412,7 @@ void pdo_dbh_init(TSRMLS_D) REGISTER_PDO_CLASS_CONST_LONG("FETCH_UNIQUE",(long)PDO_FETCH_UNIQUE); REGISTER_PDO_CLASS_CONST_LONG("FETCH_KEY_PAIR",(long)PDO_FETCH_KEY_PAIR); REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASSTYPE",(long)PDO_FETCH_CLASSTYPE); -#if PHP_MAJOR_VERSION > 5 || PHP_MINOR_VERSION >= 1 +#if PHP_VERSION_ID >= 51000 REGISTER_PDO_CLASS_CONST_LONG("FETCH_SERIALIZE",(long)PDO_FETCH_SERIALIZE); #endif REGISTER_PDO_CLASS_CONST_LONG("FETCH_PROPS_LATE",(long)PDO_FETCH_PROPS_LATE); From 0407bdf252004cce08e383bc0f4aa0bbc69c9a25 Mon Sep 17 00:00:00 2001 From: Keyur Govande Date: Fri, 15 Aug 2014 23:08:29 +0000 Subject: [PATCH 06/15] Add NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index b771ce6fd55..97adf4fe1be 100644 --- a/NEWS +++ b/NEWS @@ -59,6 +59,9 @@ PHP NEWS . Fixed bug #67724 (chained zlib filters silently fail with large amounts of data). (Mike) +- MySQLi: + . Fixed bug #67839 (mysqli does not handle 4-byte floats correctly). (Keyur) + 24 Jul 2014, PHP 5.4.31 - Core: From 48dc203408672380545012d9b6ee73df23e139fb Mon Sep 17 00:00:00 2001 From: Keyur Govande Date: Fri, 15 Aug 2014 23:26:21 +0000 Subject: [PATCH 07/15] Fix another failing test --- ext/mysqli/tests/mysqli_change_user_old.phpt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ext/mysqli/tests/mysqli_change_user_old.phpt b/ext/mysqli/tests/mysqli_change_user_old.phpt index ddb49cd1896..96357ebf511 100644 --- a/ext/mysqli/tests/mysqli_change_user_old.phpt +++ b/ext/mysqli/tests/mysqli_change_user_old.phpt @@ -48,6 +48,14 @@ if (mysqli_get_server_version($link) >= 50600) if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really'))) printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + // Reconnect because Percona and MariaDB block any commands after 3 failed + // change_user commands + mysqli_close($link); + + if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + } if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1')) printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -116,4 +124,4 @@ if (mysqli_get_server_version($link) >= 50600) print "done!"; ?> --EXPECTF-- -done! \ No newline at end of file +done! From 6279246d2c60437c583f9c273075579bf17be654 Mon Sep 17 00:00:00 2001 From: Keyur Govande Date: Fri, 15 Aug 2014 23:38:14 +0000 Subject: [PATCH 08/15] Update NEWS --- NEWS | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index e6a87e64c69..1f0dec6f04e 100644 --- a/NEWS +++ b/NEWS @@ -61,7 +61,10 @@ PHP NEWS - Zlib: . Fixed bug #67724 (chained zlib filters silently fail with large amounts of data). (Mike) - + +- MySQLi: + . Fixed bug #67839 (mysqli does not handle 4-byte floats correctly). (Keyur) + 24 Jul 2014, PHP 5.5.15 - Core: From c6d9bf294681486e7d0ae67b099c0f45e88b35ac Mon Sep 17 00:00:00 2001 From: Keyur Govande Date: Fri, 15 Aug 2014 23:49:07 +0000 Subject: [PATCH 09/15] Update NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 0906bc457ff..4ad4add9398 100644 --- a/NEWS +++ b/NEWS @@ -44,6 +44,9 @@ PHP NEWS - Date: . Fixed bug #66091 (memory leaks in DateTime constructor) (Tjerk). +- MySQLi: + . Fixed bug #67839 (mysqli does not handle 4-byte floats correctly). (Keyur) + 31 Jul 2014, PHP 5.6.0 Release Candidate 3 - Core: From d790eceb01009489358c3781c94ebea3b3400f67 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Sat, 16 Aug 2014 16:44:02 +0800 Subject: [PATCH 10/15] Fixed version id --- ext/intl/collator/collator_convert.c | 2 +- ext/mysqli/mysqli.c | 2 +- ext/pdo/pdo_dbh.c | 2 +- ext/phar/phar_object.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index e64bf880b09..7d8bf0bbc8f 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -28,7 +28,7 @@ #include #include -#if PHP_VERSION_ID <= 51000 +#if PHP_VERSION_ID <= 50100 #define CAST_OBJECT_SHOULD_FREE ,0 #else #define CAST_OBJECT_SHOULD_FREE diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index fb93095c426..02e6898f7f6 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -585,7 +585,7 @@ PHP_MINIT_FUNCTION(mysqli) mysqli_object_handlers.write_property = mysqli_write_property; mysqli_object_handlers.get_property_ptr_ptr = std_hnd->get_property_ptr_ptr; mysqli_object_handlers.has_property = mysqli_object_has_property; -#if PHP_VERSION_ID >= 53000 +#if PHP_VERSION_ID >= 50300 mysqli_object_handlers.get_debug_info = mysqli_object_get_debug_info; #endif memcpy(&mysqli_object_driver_handlers, &mysqli_object_handlers, sizeof(zend_object_handlers)); diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 28e26083abc..cdf639a72dd 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1412,7 +1412,7 @@ void pdo_dbh_init(TSRMLS_D) REGISTER_PDO_CLASS_CONST_LONG("FETCH_UNIQUE",(long)PDO_FETCH_UNIQUE); REGISTER_PDO_CLASS_CONST_LONG("FETCH_KEY_PAIR",(long)PDO_FETCH_KEY_PAIR); REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASSTYPE",(long)PDO_FETCH_CLASSTYPE); -#if PHP_VERSION_ID >= 51000 +#if PHP_VERSION_ID >= 50100 REGISTER_PDO_CLASS_CONST_LONG("FETCH_SERIALIZE",(long)PDO_FETCH_SERIALIZE); #endif REGISTER_PDO_CLASS_CONST_LONG("FETCH_PROPS_LATE",(long)PDO_FETCH_PROPS_LATE); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 74f06e71dd2..e9acfe435b5 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -30,7 +30,7 @@ static zend_class_entry *phar_ce_PharException; static zend_class_entry *phar_ce_entry; #endif -#if PHP_VERSION_ID >= 53000 +#if PHP_VERSION_ID >= 50300 # define PHAR_ARG_INFO #else # define PHAR_ARG_INFO static From 87afa6bdc9b310ebafec5d965734c4e467e27c6d Mon Sep 17 00:00:00 2001 From: Tjerk Meesters Date: Thu, 14 Aug 2014 09:25:14 +0800 Subject: [PATCH 11/15] Fixes missing Reflector interface constraints being enforced by the engine --- ext/reflection/php_reflection.c | 22 +++++-------------- .../tests/ReflectionClass_toString_001.phpt | 4 ++-- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 4248de834d2..e4ad9416f02 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -261,15 +261,6 @@ static void _default_lookup_entry(zval *object, char *name, int name_len, zval * /* }}} */ #endif -static void reflection_register_implement(zend_class_entry *class_entry, zend_class_entry *interface_entry TSRMLS_DC) /* {{{ */ -{ - zend_uint num_interfaces = ++class_entry->num_interfaces; - - class_entry->interfaces = (zend_class_entry **) realloc(class_entry->interfaces, sizeof(zend_class_entry *) * num_interfaces); - class_entry->interfaces[num_interfaces - 1] = interface_entry; -} -/* }}} */ - static zend_function *_copy_function(zend_function *fptr TSRMLS_DC) /* {{{ */ { if (fptr @@ -5687,7 +5678,6 @@ ZEND_END_ARG_INFO() static const zend_function_entry reflection_function_abstract_functions[] = { ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) - PHP_ABSTRACT_ME(reflection_function, __toString, arginfo_reflection__void) ZEND_ME(reflection_function, inNamespace, arginfo_reflection__void, 0) ZEND_ME(reflection_function, isClosure, arginfo_reflection__void, 0) ZEND_ME(reflection_function, isDeprecated, arginfo_reflection__void, 0) @@ -6094,7 +6084,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionFunctionAbstract", reflection_function_abstract_functions); _reflection_entry.create_object = reflection_objects_new; reflection_function_abstract_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC); - reflection_register_implement(reflection_function_abstract_ptr, reflector_ptr TSRMLS_CC); + zend_class_implements(reflection_function_abstract_ptr TSRMLS_CC, 1, reflector_ptr); zend_declare_property_string(reflection_function_abstract_ptr, "name", sizeof("name")-1, "", ZEND_ACC_ABSTRACT TSRMLS_CC); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionFunction", reflection_function_functions); @@ -6107,7 +6097,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionParameter", reflection_parameter_functions); _reflection_entry.create_object = reflection_objects_new; reflection_parameter_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC); - reflection_register_implement(reflection_parameter_ptr, reflector_ptr TSRMLS_CC); + zend_class_implements(reflection_parameter_ptr TSRMLS_CC, 1, reflector_ptr); zend_declare_property_string(reflection_parameter_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionMethod", reflection_method_functions); @@ -6126,7 +6116,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClass", reflection_class_functions); _reflection_entry.create_object = reflection_objects_new; reflection_class_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC); - reflection_register_implement(reflection_class_ptr, reflector_ptr TSRMLS_CC); + zend_class_implements(reflection_class_ptr TSRMLS_CC, 1, reflector_ptr); zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS); @@ -6140,7 +6130,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionProperty", reflection_property_functions); _reflection_entry.create_object = reflection_objects_new; reflection_property_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC); - reflection_register_implement(reflection_property_ptr, reflector_ptr TSRMLS_CC); + zend_class_implements(reflection_property_ptr TSRMLS_CC, 1, reflector_ptr); zend_declare_property_string(reflection_property_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_string(reflection_property_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); @@ -6152,13 +6142,13 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionExtension", reflection_extension_functions); _reflection_entry.create_object = reflection_objects_new; reflection_extension_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC); - reflection_register_implement(reflection_extension_ptr, reflector_ptr TSRMLS_CC); + zend_class_implements(reflection_extension_ptr TSRMLS_CC, 1, reflector_ptr); zend_declare_property_string(reflection_extension_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionZendExtension", reflection_zend_extension_functions); _reflection_entry.create_object = reflection_objects_new; reflection_zend_extension_ptr = zend_register_internal_class(&_reflection_entry TSRMLS_CC); - reflection_register_implement(reflection_zend_extension_ptr, reflector_ptr TSRMLS_CC); + zend_class_implements(reflection_zend_extension_ptr TSRMLS_CC, 1, reflector_ptr); zend_declare_property_string(reflection_zend_extension_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); return SUCCESS; diff --git a/ext/reflection/tests/ReflectionClass_toString_001.phpt b/ext/reflection/tests/ReflectionClass_toString_001.phpt index 508530a5478..8dd571c3a9c 100644 --- a/ext/reflection/tests/ReflectionClass_toString_001.phpt +++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt @@ -21,7 +21,7 @@ Class [ class ReflectionClass implements Reflector ] { } - Static methods [1] { - Method [ static public method export ] { + Method [ static public method export ] { - Parameters [2] { Parameter #0 [ $argument ] @@ -48,7 +48,7 @@ Class [ class ReflectionClass implements Reflector ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } From 3f42f2f5d1c8026b6e1d21b91857a08d918c28c8 Mon Sep 17 00:00:00 2001 From: Veres Lajos Date: Tue, 12 Aug 2014 22:00:23 +0100 Subject: [PATCH 12/15] typofixes --- acinclude.m4 | 2 +- ext/ereg/tests/eregi_basic.phpt | 2 +- ext/json/json.c | 2 +- ext/mysqlnd/mysqlnd_result.c | 2 +- ext/pcre/pcrelib/ChangeLog | 2 +- ext/soap/interop/client_round2_interop.php | 2 +- ext/spl/php_spl.c | 2 +- ext/standard/tests/strings/dirname_basic.phpt | 2 +- ext/standard/url.c | 2 +- scripts/dev/find_tested.php | 2 +- server-tests-config.php | 2 +- win32/build/confutils.js | 2 +- win32/sendmail.h | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 25f3655112c..4fd452ee92a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2800,7 +2800,7 @@ AC_DEFUN([PHP_DETECT_ICC], dnl PHP_DETECT_SUNCC dnl Detect if the systems default compiler is suncc. -dnl We also set some usefull CFLAGS if the user didn't set any +dnl We also set some useful CFLAGS if the user didn't set any AC_DEFUN([PHP_DETECT_SUNCC],[ SUNCC="no" AC_MSG_CHECKING([for suncc]) diff --git a/ext/ereg/tests/eregi_basic.phpt b/ext/ereg/tests/eregi_basic.phpt index 14b4b7d3952..cbcfdb6554b 100644 --- a/ext/ereg/tests/eregi_basic.phpt +++ b/ext/ereg/tests/eregi_basic.phpt @@ -9,7 +9,7 @@ Test eregi() function : basic functionality - confirm case insensitivity */ /* - * Test basic funtionality of eregi() + * Test basic functionality of eregi() */ echo "*** Testing eregi() : basic functionality ***\n"; diff --git a/ext/json/json.c b/ext/json/json.c index b3240e1b4bf..87de49cb8c6 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -368,7 +368,7 @@ static int json_utf8_to_utf16(unsigned short *utf16, char utf8[], int len) /* {{ } } } else { - /* Only check if utf8 string is valid, and compute utf16 lenght */ + /* Only check if utf8 string is valid, and compute utf16 length */ for (j=0 ; pos < len ; j++) { us = php_next_utf8_char((const unsigned char *)utf8, len, &pos, &status); if (status != SUCCESS) { diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index 08149264839..bb4dc09c7b5 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -1182,7 +1182,7 @@ MYSQLND_METHOD(mysqlnd_res, store_result_fetch_data)(MYSQLND_CONN_DATA * const c No need to FREE_ALLOCA as we can reuse the 'lengths' and 'fields' arrays. For lengths its absolutely safe. 'fields' is reused because the ownership of the strings has been - transfered above. + transferred above. */ } /* Overflow ? */ diff --git a/ext/pcre/pcrelib/ChangeLog b/ext/pcre/pcrelib/ChangeLog index ed164fed0fc..e5c6bc8a709 100644 --- a/ext/pcre/pcrelib/ChangeLog +++ b/ext/pcre/pcrelib/ChangeLog @@ -4935,7 +4935,7 @@ by an auxiliary program - but can then be edited by hand if required. There are now no calls to isalnum(), isspace(), isdigit(), isxdigit(), tolower() or toupper() in the code. -7. Turn the malloc/free funtions variables into pcre_malloc and pcre_free and +7. Turn the malloc/free functions variables into pcre_malloc and pcre_free and make them global. Abolish the function for setting them, as the caller can now set them directly. diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php index b8ee893d8da..fd5767cc179 100644 --- a/ext/soap/interop/client_round2_interop.php +++ b/ext/soap/interop/client_round2_interop.php @@ -373,7 +373,7 @@ class Interop_Client } $soap =& $endpoint_info['client']; - # XXX how do we determine a failure on retreiving/parsing wsdl? + # XXX how do we determine a failure on retrieving/parsing wsdl? if ($soap->wsdl->fault) { $fault = $soap->wsdl->fault; $soap_test->setResult(0,'WSDL', diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index a37a453c8c5..473ab00963f 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -326,7 +326,7 @@ PHP_FUNCTION(spl_autoload) RETURN_FALSE; } - if (file_exts == NULL) { /* autoload_extensions is not intialzed, set to defaults */ + if (file_exts == NULL) { /* autoload_extensions is not initialzed, set to defaults */ copy = pos1 = estrndup(SPL_DEFAULT_FILE_EXTENSIONS, sizeof(SPL_DEFAULT_FILE_EXTENSIONS)-1); } else { copy = pos1 = estrndup(file_exts, file_exts_len); diff --git a/ext/standard/tests/strings/dirname_basic.phpt b/ext/standard/tests/strings/dirname_basic.phpt index 2b5e4d43d97..33fee611e0b 100644 --- a/ext/standard/tests/strings/dirname_basic.phpt +++ b/ext/standard/tests/strings/dirname_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -Test dirname() function : basic funtionality +Test dirname() function : basic functionality --FILE-- = s && *p != ':'; p--); } diff --git a/scripts/dev/find_tested.php b/scripts/dev/find_tested.php index f95c46251c5..e841e2e9595 100644 --- a/scripts/dev/find_tested.php +++ b/scripts/dev/find_tested.php @@ -88,7 +88,7 @@ function mark_methods_as_tested($method_info, $phpt_files) { foreach($tested_functions as $tested_function) { - // go through method info array marking this funtion as tested + // go through method info array marking this function as tested foreach($method_info as &$current_method_record) { if (strcasecmp($tested_function, $current_method_record[METHOD_NAME]) == 0) { // matched the method name diff --git a/server-tests-config.php b/server-tests-config.php index 0ddff28cb23..a4fa88a5b2b 100755 --- a/server-tests-config.php +++ b/server-tests-config.php @@ -52,7 +52,7 @@ $conf = array( /* file extension of pages requested via http this allows for php to be configured to parse - extensions other than php, usefull for multiple + extensions other than php, useful for multiple configurations under a single webserver */ 'TEST_WEB_EXT' => 'php', diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 8da760406c9..21513613687 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -1499,7 +1499,7 @@ function output_as_table(header, ar_out) { var l = header.length; var cols = 80; - var fixedlenght = ""; + var fixedlength = ""; var t = 0; var i,j,k,m; var out = "| "; diff --git a/win32/sendmail.h b/win32/sendmail.h index 0a7698e2fef..6fed77ea066 100644 --- a/win32/sendmail.h +++ b/win32/sendmail.h @@ -5,7 +5,7 @@ #endif #define HOST_NAME_LEN 256 -#define MAX_APPNAME_LENGHT 100 +#define MAX_APPNAME_LENGTH 100 #define MAIL_BUFFER_SIZE (1024*4) /* 4k buffer */ /* Return values */ #define MIN_ERROR_INDEX 0 /* Always 0 like SUCCESS */ From 1e3452992fac7536d30a92955b20b8af038f1ef7 Mon Sep 17 00:00:00 2001 From: Veres Lajos Date: Sun, 17 Aug 2014 16:00:39 +0300 Subject: [PATCH 13/15] typofixes --- ext/fileinfo/tests/magic | 12 ++++++------ ext/mbstring/oniguruma/HISTORY | 4 ++-- ext/mysqli/tests/mysqli_store_result_copy.phpt | 2 +- sapi/phpdbg/phpdbg_help.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ext/fileinfo/tests/magic b/ext/fileinfo/tests/magic index dc80e8d3705..4e1ce98ed2e 100644 --- a/ext/fileinfo/tests/magic +++ b/ext/fileinfo/tests/magic @@ -3474,7 +3474,7 @@ >>>0x44 string =GLOB \b. >>>>0x60 beshort x \b%.4d -# Scripts that run in the embeded Python interpreter +# Scripts that run in the embedded Python interpreter 0 string #!BPY Blender3D BPython script #------------------------------------------------------------------------------ @@ -5154,7 +5154,7 @@ >>0 ubyte 0xF5 FoxPro with memo # http://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx #>>0 ubyte 0xFA FoxPro 2.x, with memo -# unkown version (should not happen) +# unknown version (should not happen) >>0 default x xBase >>>0 ubyte x (0x%x) # flags in version byte @@ -5226,7 +5226,7 @@ >>>>0 ubelong =0 \b, next free block index %lu >>>>0 ubelong !0 \b, next free block index %lu >>>512 default x dBase IV DBT -# DBF file name without extention +# DBF file name without extension >>>>8 string >\0 \b of %-.8s.DBF # size of blocks ; not reliable 0x2020204C #>>>>4 ulelong =0 \b, blocks size %lu @@ -6591,7 +6591,7 @@ >>>>>379 string GRUB\ \0 \b, GRUB version 0.95 or 0.96 >>>>391 string Geom\0Hard\ Disk\0Read\0\ Error\0 >>>>>385 string GRUB\ \0 \b, GRUB version 0.97 -#unkown version +#unknown version >>>343 string Geom\0Read\0\ Error\0 >>>>321 string Loading\ stage1.5 \b, GRUB version x.y >>>380 string Geom\0Hard\ Disk\0Read\0\ Error\0 @@ -12695,7 +12695,7 @@ #>65 string ZSYS (Pre-System 7 system file) #>65 string acf3 (Aldus FreeHand) #>65 string cdev (control panel) -#>65 string dfil (Desk Acessory suitcase) +#>65 string dfil (Desk Accessory suitcase) #>65 string libr (library) #>65 string nX^d (WriteNow word processor) #>65 string nX^w (WriteNow dictionary) @@ -17992,7 +17992,7 @@ # $File: sysex,v 1.7 2013/09/16 15:12:42 christos Exp $ # sysex: file(1) magic for MIDI sysex files # -# GRR: orginal 1 byte test at offset was too general as it catches also many FATs of DOS filesystems +# GRR: original 1 byte test at offset was too general as it catches also many FATs of DOS filesystems # where real SYStem EXclusive messages at offset 1 are limited to seven bits # http://en.wikipedia.org/wiki/MIDI 0 ubeshort&0xFF80 0xF000 SysEx File - diff --git a/ext/mbstring/oniguruma/HISTORY b/ext/mbstring/oniguruma/HISTORY index 6b3031bcb6e..969deec36b2 100644 --- a/ext/mbstring/oniguruma/HISTORY +++ b/ext/mbstring/oniguruma/HISTORY @@ -897,7 +897,7 @@ History 2004/10/18: [impl] (thanks Imai Yasumasa) enclose #include by #ifndef __BORLANDC__. 2004/10/18: [bug] (thanks Imai Yasumasa) - memory acess violation in select_opt_exact_info(). + memory access violation in select_opt_exact_info(). 2004/09/25: [dist] fix doc/API and doc/API.ja. 2004/09/25: [bug] fix OP_SEMI_END_BUF process in match_at() for the case USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE @@ -1831,7 +1831,7 @@ History 2003/01/31: [impl] rename TTRANS() to TOLOWER(). 2003/01/30: [bug] .c.o --> .c.obj in win32\Makefile. 2003/01/30: [impl] add -DNOT_RUBY to Makefile.in. - NOT_RUBY is refered in regint.h for escape double + NOT_RUBY is referred in regint.h for escape double including config.h. 2003/01/30: [impl] when string hasn't case ambiguity, don't compile to ignore case opcode. diff --git a/ext/mysqli/tests/mysqli_store_result_copy.phpt b/ext/mysqli/tests/mysqli_store_result_copy.phpt index 304300459b9..cdbccee1987 100644 --- a/ext/mysqli/tests/mysqli_store_result_copy.phpt +++ b/ext/mysqli/tests/mysqli_store_result_copy.phpt @@ -75,7 +75,7 @@ mysqlnd.fetch_data_copy=0 printf("No result: %d\n", $no_result); /* implicit free, implicit store */ - /* meta and fetch lenghts code */ + /* meta and fetch lengths code */ if (!$res = mysqli_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2")) printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/sapi/phpdbg/phpdbg_help.c b/sapi/phpdbg/phpdbg_help.c index 1e58dc69cad..c552529930c 100644 --- a/sapi/phpdbg/phpdbg_help.c +++ b/sapi/phpdbg/phpdbg_help.c @@ -362,7 +362,7 @@ phpdbg_help_text_t phpdbg_help_text[] = { " **-c** **-c**/my/php.ini Set php.ini file to load" CR " **-d** **-d**memory_limit=4G Set a php.ini directive" CR " **-n** Disable default php.ini" CR -" **-q** Supress welcome banner" CR +" **-q** Suppress welcome banner" CR " **-v** Enable oplog output" CR " **-s** Enable stepping" CR " **-b** Disable colour" CR @@ -545,7 +545,7 @@ phpdbg_help_text_t phpdbg_help_text[] = { " $P break ZEND_ADD" CR " $P b ZEND_ADD" CR -" Break on any occurence of the opcode ZEND_ADD" CR CR +" Break on any occurrence of the opcode ZEND_ADD" CR CR " $P break del 2" CR " $P b ~ 2" CR From 1504f7d630c01fcfe9cd23b9e8aff7195a3864f7 Mon Sep 17 00:00:00 2001 From: Lior Kaplan Date: Sun, 17 Aug 2014 21:32:53 +0300 Subject: [PATCH 14/15] Correct typo in comments: 'initialized' --- ext/dom/php_dom.c | 2 +- ext/mbstring/mb_gpc.c | 2 +- ext/spl/php_spl.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index dda638abd0e..3e619e1f0e3 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -518,7 +518,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp TSRMLS_DC value = null_value; } else if (Z_TYPE_P(value) == IS_OBJECT) { /* these are zvalues create on demand, with refcount and is_ref - * status left in an uninitalized stated */ + * status left in an uninitialized stated */ zval_dtor(value); efree(value); diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c index 8924b065c83..aec5adf5534 100644 --- a/ext/mbstring/mb_gpc.c +++ b/ext/mbstring/mb_gpc.c @@ -260,7 +260,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i goto out; } - num = n; /* make sure to process initilized vars only */ + num = n; /* make sure to process initialized vars only */ /* initialize converter */ if (info->num_from_encodings <= 0) { diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 473ab00963f..515b5ccfe62 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -326,7 +326,7 @@ PHP_FUNCTION(spl_autoload) RETURN_FALSE; } - if (file_exts == NULL) { /* autoload_extensions is not initialzed, set to defaults */ + if (file_exts == NULL) { /* autoload_extensions is not initialized, set to defaults */ copy = pos1 = estrndup(SPL_DEFAULT_FILE_EXTENSIONS, sizeof(SPL_DEFAULT_FILE_EXTENSIONS)-1); } else { copy = pos1 = estrndup(file_exts, file_exts_len); From 3e79907b0abb0a9d0ff1580febb9d70dc095195c Mon Sep 17 00:00:00 2001 From: Tjerk Meesters Date: Mon, 18 Aug 2014 06:54:50 +0800 Subject: [PATCH 15/15] Updated NEWS for d790ec --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index a5912f397d6..1bef17b6adf 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ PHP NEWS - Core: . Added PHP_INT_MIN constant. (Andrea) + . Fixed inheritance chain of Reflector in ext/reflection (Tjerk) - DBA: . Fixed bug #62490 (dba_delete returns true on missing item (inifile)). (Mike)