diff options
author | Ondřej Surý <ondrej@sury.org> | 2013-07-22 08:22:22 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2013-07-22 08:22:22 +0200 |
commit | d837b4550418036e76d6adb3c7dad94b1e3a5a6a (patch) | |
tree | 1f1c808039c898d7d891975d3788531a2a6550f1 /ext | |
parent | 706ac6417162d94eb701952d40df136cd9528b56 (diff) | |
download | php-d837b4550418036e76d6adb3c7dad94b1e3a5a6a.tar.gz |
New upstream version 5.5.1+dfsgupstream/5.5.1+dfsg
Diffstat (limited to 'ext')
171 files changed, 2757 insertions, 921 deletions
diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index 8289322d6..556f356b9 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -102,8 +102,9 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep { OLECHAR *olestring; php_com_dotnet_object *obj; + zend_uchar ztype = (z == NULL ? IS_NULL : Z_TYPE_P(z)); - switch (Z_TYPE_P(z)) { + switch (ztype) { case IS_NULL: V_VT(v) = VT_NULL; break; diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 2d5414031..4b6e5e27d 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -958,7 +958,7 @@ PHP_MINIT_FUNCTION(curl) REGISTER_CURL_CONSTANT(CURLFTPMETHOD_SINGLECWD); #endif -#if LIBCURL_VERSION_NUM >- 0x070f04 /* Available since 7.15.4 */ +#if LIBCURL_VERSION_NUM >= 0x070f04 /* Available since 7.15.4 */ REGISTER_CURL_CONSTANT(CURLINFO_FTP_ENTRY_PATH); #endif diff --git a/ext/date/lib/timezonedb.h b/ext/date/lib/timezonedb.h index 2f9d8fe66..1e5706cdc 100644 --- a/ext/date/lib/timezonedb.h +++ b/ext/date/lib/timezonedb.h @@ -766,8 +766,8 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x1A, 0xB7, 0xA6, 0x00, 0x1E, 0x18, 0x6F, 0xF0, 0x48, 0x41, 0xE6, 0x80, 0x48, 0xBB, 0x22, 0x70, 0x4A, 0x23, 0x1A, 0x00, 0x4A, 0x8D, 0xD5, 0x70, 0x4B, 0xDC, 0xC0, 0x80, 0x4C, 0x5D, 0xE5, 0x70, 0x4D, 0x97, 0xB8, 0x80, 0x4E, 0x34, 0x8C, 0xF0, 0x4F, 0x9C, 0xA0, 0xA0, 0x50, 0x08, 0xBB, 0xA0, -0x50, 0x31, 0x9A, 0x20, 0x50, 0x67, 0xA7, 0xA0, 0x51, 0x7C, 0x82, 0xA0, 0x51, 0xDB, 0x6E, 0xA0, -0x52, 0x02, 0xFB, 0xA0, 0x52, 0x47, 0x89, 0xA0, 0x53, 0x5C, 0x64, 0xA0, 0x53, 0xAF, 0x73, 0x20, +0x50, 0x31, 0x9A, 0x20, 0x50, 0x67, 0xA7, 0xA0, 0x51, 0x7C, 0x82, 0xA0, 0x51, 0xD8, 0xCB, 0xA0, +0x52, 0x05, 0x9E, 0xA0, 0x52, 0x47, 0x89, 0xA0, 0x53, 0x5C, 0x64, 0xA0, 0x53, 0xAF, 0x73, 0x20, 0x53, 0xD7, 0x00, 0x20, 0x54, 0x27, 0x6B, 0xA0, 0x55, 0x3C, 0x46, 0xA0, 0x55, 0x82, 0x26, 0x20, 0x55, 0xA9, 0xB3, 0x20, 0x56, 0x07, 0x4D, 0xA0, 0x57, 0x1C, 0x28, 0xA0, 0x57, 0x56, 0x2A, 0xA0, 0x57, 0x7D, 0xB7, 0xA0, 0x57, 0xE7, 0x2F, 0xA0, 0x59, 0x05, 0x45, 0x20, 0x59, 0x28, 0xDD, 0xA0, @@ -7248,7 +7248,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x8C, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x9A, 0xB0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x9A, 0xB0, 0x01, 0x00, 0x00, 0x00, 0x8C, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x9A, 0xB0, 0x00, 0x08, 0x45, 0x53, 0x54, 0x00, 0x7A, 0x7A, 0x7A, 0x00, 0x4D, 0x49, 0x53, 0x54, 0x00, 0x00, -0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x2B, 0x30, 0x02, +0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x2B, 0x30, 0x02, 0x05, 0x32, 0x58, 0x00, 0x00, 0x00, 0x10, 0x4D, 0x61, 0x63, 0x71, 0x75, 0x61, 0x72, 0x69, 0x65, 0x20, 0x49, 0x73, 0x6C, 0x61, 0x6E, 0x64, @@ -8441,19 +8441,19 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x46, 0xEC, 0x63, 0xF0, 0x47, 0xEC, 0x35, 0x00, 0x48, 0xE7, 0xF5, 0x70, 0x49, 0xCC, 0x17, 0x00, 0x4A, 0xBE, 0x9C, 0xF0, 0x4B, 0xAB, 0xF9, 0x00, 0x4C, 0x8C, 0x09, 0xF0, 0x4D, 0x95, 0x15, 0x80, 0x4E, 0x87, 0x9B, 0x70, 0x4F, 0x74, 0xF7, 0x80, 0x50, 0x5E, 0x42, 0xF0, 0x51, 0x54, 0xD9, 0x80, -0x52, 0x50, 0x99, 0xF0, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x30, 0x7B, 0xF0, 0x55, 0x14, 0x9D, 0x80, -0x56, 0x10, 0x5D, 0xF0, 0x56, 0xF4, 0x7F, 0x80, 0x57, 0xF0, 0x3F, 0xF0, 0x58, 0xD4, 0x61, 0x80, -0x59, 0xD9, 0x5C, 0x70, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xB9, 0x3E, 0x70, 0x5C, 0x9D, 0x60, 0x00, -0x5D, 0x99, 0x20, 0x70, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x79, 0x02, 0x70, 0x60, 0x5D, 0x24, 0x00, -0x61, 0x58, 0xE4, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x38, 0xC6, 0x70, 0x64, 0x1C, 0xE8, 0x00, -0x65, 0x21, 0xE2, 0xF0, 0x66, 0x06, 0x04, 0x80, 0x67, 0x01, 0xC4, 0xF0, 0x67, 0xE5, 0xE6, 0x80, -0x68, 0xE1, 0xA6, 0xF0, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xC1, 0x88, 0xF0, 0x6B, 0xA5, 0xAA, 0x80, -0x6C, 0xA2, 0xBC, 0x70, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0x8A, 0x87, 0x70, 0x6F, 0x65, 0x6E, 0x80, -0x70, 0x6A, 0x69, 0x70, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x4A, 0x4B, 0x70, 0x73, 0x2E, 0x6D, 0x00, -0x74, 0x2A, 0x2D, 0x70, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x0A, 0x0F, 0x70, 0x76, 0xEE, 0x31, 0x00, -0x77, 0xE9, 0xF1, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xD3, 0x0D, 0xF0, 0x7A, 0xAD, 0xF5, 0x00, -0x7B, 0xB2, 0xEF, 0xF0, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0x92, 0xD1, 0xF0, 0x7E, 0x76, 0xF3, 0x80, -0x7F, 0x72, 0xB3, 0xF0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, +0x52, 0x6C, 0x49, 0x70, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x4C, 0x2B, 0x70, 0x55, 0x14, 0x9D, 0x80, +0x56, 0x2C, 0x0D, 0x70, 0x56, 0xF4, 0x7F, 0x80, 0x58, 0x15, 0x29, 0xF0, 0x58, 0xD4, 0x61, 0x80, +0x59, 0xF5, 0x0B, 0xF0, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xD4, 0xED, 0xF0, 0x5C, 0x9D, 0x60, 0x00, +0x5D, 0xB4, 0xCF, 0xF0, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x94, 0xB1, 0xF0, 0x60, 0x5D, 0x24, 0x00, +0x61, 0x7D, 0xCE, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x5D, 0xB0, 0x70, 0x64, 0x1C, 0xE8, 0x00, +0x65, 0x3D, 0x92, 0x70, 0x66, 0x06, 0x04, 0x80, 0x67, 0x1D, 0x74, 0x70, 0x67, 0xE5, 0xE6, 0x80, +0x68, 0xFD, 0x56, 0x70, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xDD, 0x38, 0x70, 0x6B, 0xA5, 0xAA, 0x80, +0x6C, 0xC6, 0x54, 0xF0, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0xA6, 0x36, 0xF0, 0x6F, 0x65, 0x6E, 0x80, +0x70, 0x86, 0x18, 0xF0, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x65, 0xFA, 0xF0, 0x73, 0x2E, 0x6D, 0x00, +0x74, 0x45, 0xDC, 0xF0, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x2E, 0xF9, 0x70, 0x76, 0xEE, 0x31, 0x00, +0x78, 0x0E, 0xDB, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xEE, 0xBD, 0x70, 0x7A, 0xAD, 0xF5, 0x00, +0x7B, 0xCE, 0x9F, 0x70, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0xAE, 0x81, 0x70, 0x7E, 0x76, 0xF3, 0x80, +0x7F, 0x8E, 0x63, 0x70, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, @@ -8465,7 +8465,7 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x01, 0x02, 0x00, 0x00, 0x20, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x30, 0x01, 0x04, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x08, 0x00, 0x00, 0x38, 0x40, 0x01, 0x0C, 0x4A, 0x4D, 0x54, 0x00, 0x49, 0x44, 0x54, 0x00, 0x49, 0x53, 0x54, 0x00, 0x49, 0x44, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0xB9, 0xCD, 0x1A, 0x01, 0x48, 0x6B, 0x85, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xB9, 0xD2, 0x87, 0x01, 0x48, 0x67, 0xD4, 0x00, 0x00, 0x00, 0x00, /* Asia/Kabul */ 0x50, 0x48, 0x50, 0x31, 0x01, 0x41, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -9310,19 +9310,19 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x46, 0xEC, 0x63, 0xF0, 0x47, 0xEC, 0x35, 0x00, 0x48, 0xE7, 0xF5, 0x70, 0x49, 0xCC, 0x17, 0x00, 0x4A, 0xBE, 0x9C, 0xF0, 0x4B, 0xAB, 0xF9, 0x00, 0x4C, 0x8C, 0x09, 0xF0, 0x4D, 0x95, 0x15, 0x80, 0x4E, 0x87, 0x9B, 0x70, 0x4F, 0x74, 0xF7, 0x80, 0x50, 0x5E, 0x42, 0xF0, 0x51, 0x54, 0xD9, 0x80, -0x52, 0x50, 0x99, 0xF0, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x30, 0x7B, 0xF0, 0x55, 0x14, 0x9D, 0x80, -0x56, 0x10, 0x5D, 0xF0, 0x56, 0xF4, 0x7F, 0x80, 0x57, 0xF0, 0x3F, 0xF0, 0x58, 0xD4, 0x61, 0x80, -0x59, 0xD9, 0x5C, 0x70, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xB9, 0x3E, 0x70, 0x5C, 0x9D, 0x60, 0x00, -0x5D, 0x99, 0x20, 0x70, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x79, 0x02, 0x70, 0x60, 0x5D, 0x24, 0x00, -0x61, 0x58, 0xE4, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x38, 0xC6, 0x70, 0x64, 0x1C, 0xE8, 0x00, -0x65, 0x21, 0xE2, 0xF0, 0x66, 0x06, 0x04, 0x80, 0x67, 0x01, 0xC4, 0xF0, 0x67, 0xE5, 0xE6, 0x80, -0x68, 0xE1, 0xA6, 0xF0, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xC1, 0x88, 0xF0, 0x6B, 0xA5, 0xAA, 0x80, -0x6C, 0xA2, 0xBC, 0x70, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0x8A, 0x87, 0x70, 0x6F, 0x65, 0x6E, 0x80, -0x70, 0x6A, 0x69, 0x70, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x4A, 0x4B, 0x70, 0x73, 0x2E, 0x6D, 0x00, -0x74, 0x2A, 0x2D, 0x70, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x0A, 0x0F, 0x70, 0x76, 0xEE, 0x31, 0x00, -0x77, 0xE9, 0xF1, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xD3, 0x0D, 0xF0, 0x7A, 0xAD, 0xF5, 0x00, -0x7B, 0xB2, 0xEF, 0xF0, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0x92, 0xD1, 0xF0, 0x7E, 0x76, 0xF3, 0x80, -0x7F, 0x72, 0xB3, 0xF0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, +0x52, 0x6C, 0x49, 0x70, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x4C, 0x2B, 0x70, 0x55, 0x14, 0x9D, 0x80, +0x56, 0x2C, 0x0D, 0x70, 0x56, 0xF4, 0x7F, 0x80, 0x58, 0x15, 0x29, 0xF0, 0x58, 0xD4, 0x61, 0x80, +0x59, 0xF5, 0x0B, 0xF0, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xD4, 0xED, 0xF0, 0x5C, 0x9D, 0x60, 0x00, +0x5D, 0xB4, 0xCF, 0xF0, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x94, 0xB1, 0xF0, 0x60, 0x5D, 0x24, 0x00, +0x61, 0x7D, 0xCE, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x5D, 0xB0, 0x70, 0x64, 0x1C, 0xE8, 0x00, +0x65, 0x3D, 0x92, 0x70, 0x66, 0x06, 0x04, 0x80, 0x67, 0x1D, 0x74, 0x70, 0x67, 0xE5, 0xE6, 0x80, +0x68, 0xFD, 0x56, 0x70, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xDD, 0x38, 0x70, 0x6B, 0xA5, 0xAA, 0x80, +0x6C, 0xC6, 0x54, 0xF0, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0xA6, 0x36, 0xF0, 0x6F, 0x65, 0x6E, 0x80, +0x70, 0x86, 0x18, 0xF0, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x65, 0xFA, 0xF0, 0x73, 0x2E, 0x6D, 0x00, +0x74, 0x45, 0xDC, 0xF0, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x2E, 0xF9, 0x70, 0x76, 0xEE, 0x31, 0x00, +0x78, 0x0E, 0xDB, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xEE, 0xBD, 0x70, 0x7A, 0xAD, 0xF5, 0x00, +0x7B, 0xCE, 0x9F, 0x70, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0xAE, 0x81, 0x70, 0x7E, 0x76, 0xF3, 0x80, +0x7F, 0x8E, 0x63, 0x70, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, @@ -16249,19 +16249,19 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x46, 0xEC, 0x63, 0xF0, 0x47, 0xEC, 0x35, 0x00, 0x48, 0xE7, 0xF5, 0x70, 0x49, 0xCC, 0x17, 0x00, 0x4A, 0xBE, 0x9C, 0xF0, 0x4B, 0xAB, 0xF9, 0x00, 0x4C, 0x8C, 0x09, 0xF0, 0x4D, 0x95, 0x15, 0x80, 0x4E, 0x87, 0x9B, 0x70, 0x4F, 0x74, 0xF7, 0x80, 0x50, 0x5E, 0x42, 0xF0, 0x51, 0x54, 0xD9, 0x80, -0x52, 0x50, 0x99, 0xF0, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x30, 0x7B, 0xF0, 0x55, 0x14, 0x9D, 0x80, -0x56, 0x10, 0x5D, 0xF0, 0x56, 0xF4, 0x7F, 0x80, 0x57, 0xF0, 0x3F, 0xF0, 0x58, 0xD4, 0x61, 0x80, -0x59, 0xD9, 0x5C, 0x70, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xB9, 0x3E, 0x70, 0x5C, 0x9D, 0x60, 0x00, -0x5D, 0x99, 0x20, 0x70, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x79, 0x02, 0x70, 0x60, 0x5D, 0x24, 0x00, -0x61, 0x58, 0xE4, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x38, 0xC6, 0x70, 0x64, 0x1C, 0xE8, 0x00, -0x65, 0x21, 0xE2, 0xF0, 0x66, 0x06, 0x04, 0x80, 0x67, 0x01, 0xC4, 0xF0, 0x67, 0xE5, 0xE6, 0x80, -0x68, 0xE1, 0xA6, 0xF0, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xC1, 0x88, 0xF0, 0x6B, 0xA5, 0xAA, 0x80, -0x6C, 0xA2, 0xBC, 0x70, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0x8A, 0x87, 0x70, 0x6F, 0x65, 0x6E, 0x80, -0x70, 0x6A, 0x69, 0x70, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x4A, 0x4B, 0x70, 0x73, 0x2E, 0x6D, 0x00, -0x74, 0x2A, 0x2D, 0x70, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x0A, 0x0F, 0x70, 0x76, 0xEE, 0x31, 0x00, -0x77, 0xE9, 0xF1, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xD3, 0x0D, 0xF0, 0x7A, 0xAD, 0xF5, 0x00, -0x7B, 0xB2, 0xEF, 0xF0, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0x92, 0xD1, 0xF0, 0x7E, 0x76, 0xF3, 0x80, -0x7F, 0x72, 0xB3, 0xF0, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, +0x52, 0x6C, 0x49, 0x70, 0x53, 0x34, 0xBB, 0x80, 0x54, 0x4C, 0x2B, 0x70, 0x55, 0x14, 0x9D, 0x80, +0x56, 0x2C, 0x0D, 0x70, 0x56, 0xF4, 0x7F, 0x80, 0x58, 0x15, 0x29, 0xF0, 0x58, 0xD4, 0x61, 0x80, +0x59, 0xF5, 0x0B, 0xF0, 0x5A, 0xB4, 0x43, 0x80, 0x5B, 0xD4, 0xED, 0xF0, 0x5C, 0x9D, 0x60, 0x00, +0x5D, 0xB4, 0xCF, 0xF0, 0x5E, 0x7D, 0x42, 0x00, 0x5F, 0x94, 0xB1, 0xF0, 0x60, 0x5D, 0x24, 0x00, +0x61, 0x7D, 0xCE, 0x70, 0x62, 0x3D, 0x06, 0x00, 0x63, 0x5D, 0xB0, 0x70, 0x64, 0x1C, 0xE8, 0x00, +0x65, 0x3D, 0x92, 0x70, 0x66, 0x06, 0x04, 0x80, 0x67, 0x1D, 0x74, 0x70, 0x67, 0xE5, 0xE6, 0x80, +0x68, 0xFD, 0x56, 0x70, 0x69, 0xC5, 0xC8, 0x80, 0x6A, 0xDD, 0x38, 0x70, 0x6B, 0xA5, 0xAA, 0x80, +0x6C, 0xC6, 0x54, 0xF0, 0x6D, 0x85, 0x8C, 0x80, 0x6E, 0xA6, 0x36, 0xF0, 0x6F, 0x65, 0x6E, 0x80, +0x70, 0x86, 0x18, 0xF0, 0x71, 0x4E, 0x8B, 0x00, 0x72, 0x65, 0xFA, 0xF0, 0x73, 0x2E, 0x6D, 0x00, +0x74, 0x45, 0xDC, 0xF0, 0x75, 0x0E, 0x4F, 0x00, 0x76, 0x2E, 0xF9, 0x70, 0x76, 0xEE, 0x31, 0x00, +0x78, 0x0E, 0xDB, 0x70, 0x78, 0xCE, 0x13, 0x00, 0x79, 0xEE, 0xBD, 0x70, 0x7A, 0xAD, 0xF5, 0x00, +0x7B, 0xCE, 0x9F, 0x70, 0x7C, 0x97, 0x11, 0x80, 0x7D, 0xAE, 0x81, 0x70, 0x7E, 0x76, 0xF3, 0x80, +0x7F, 0x8E, 0x63, 0x70, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, @@ -18410,4 +18410,4 @@ const unsigned char timelib_timezone_db_data_builtin[261525] = { 0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 0x12, 0xA8, 0x80, 0x00, 0x00, 0x00, 0x00, }; -const timelib_tzdb timezonedb_builtin = { "2013.3", 579, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; +const timelib_tzdb timezonedb_builtin = { "2013.4", 579, timezonedb_idx_builtin, timelib_timezone_db_data_builtin }; diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 28ac86b11..0f8822a90 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1678,6 +1678,13 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) break; } } +#if defined(PHP_WIN32) && _MSC_VER >= 1700 + /* VS2012 strftime() returns number of characters, not bytes. + See VC++11 bug id 766205. */ + if (real_len > 0) { + real_len = strlen(buf); + } +#endif timelib_time_dtor(ts); if (!gmt) { diff --git a/ext/date/tests/bug52062.phpt b/ext/date/tests/bug52062.phpt index 1d814377c..81e767b0f 100644 --- a/ext/date/tests/bug52062.phpt +++ b/ext/date/tests/bug52062.phpt @@ -4,8 +4,6 @@ Bug #52062 (large timestamps with DateTime::getTimestamp and DateTime::setTimest <?php if (PHP_INT_SIZE == 8) die('skip 32-bit only'); ?> ---XFAIL-- -Waiting for resolution of the 32-bit case. --INI-- date.timezone=UTC --FILE-- diff --git a/ext/date/tests/bug55397.phpt b/ext/date/tests/bug55397.phpt index 13778a00b..7c9bbb01c 100644 --- a/ext/date/tests/bug55397.phpt +++ b/ext/date/tests/bug55397.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #55397 (comparsion of incomplete DateTime causes SIGSEGV) +Bug #55397 (comparison of incomplete DateTime causes SIGSEGV) --INI-- --FILE-- <?php diff --git a/ext/date/tests/bug65184.phpt b/ext/date/tests/bug65184.phpt new file mode 100644 index 000000000..adfd8d812 --- /dev/null +++ b/ext/date/tests/bug65184.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test bug #65184 strftime() returns insufficient-length string under multibyte locales +--SKIPIF-- +<?php +if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { + die("skip Test is valid for Windows"); +} +?> +--FILE-- +<?php + setlocale(LC_ALL, 'Japanese_Japan.932'); + /* timestamp has to be some wednesday */ + $s = strftime('%A', 1372884126); + + for ($i = 0; $i < strlen($s); $i++) { + printf("%x ", ord($s[$i])); + } + echo "\n"; + + echo strlen(strftime('%A')), "\n"; +?> +===DONE=== +--EXPECT-- +90 85 97 6a 93 fa +6 +===DONE=== diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 5273c05fa..8005101de 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -888,7 +888,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) RETURN_FALSE; } if (hptr->flags & (DBA_NO_APPEND|DBA_CAST_AS_FD)) { - /* Needed becasue some systems do not allow to write to the original + /* Needed because some systems do not allow to write to the original * file contents with O_APPEND being set. */ if (SUCCESS != php_stream_cast(info->fp, PHP_STREAM_AS_FD, (void*)&info->fd, 1)) { diff --git a/ext/dba/tests/bug38698.phpt b/ext/dba/tests/bug38698.phpt index 56dde8526..1d1ed674f 100644 --- a/ext/dba/tests/bug38698.phpt +++ b/ext/dba/tests/bug38698.phpt @@ -8,10 +8,18 @@ Bug #38698 (Bug #38698 for some keys cdbmake creates corrupted db and cdb can't --FILE-- <?php +function isLittleEndian() { + return 0x00FF === current(unpack('v', pack('S',0x00FF))); +} + $db_file = dirname(__FILE__) .'/129php.cdb'; if (($db_make=dba_open($db_file, "n", 'cdb_make'))!==FALSE) { - dba_insert(pack('i',129), "Booo!", $db_make); + if (isLittleEndian() === FALSE) { + dba_insert(pack('V',129), "Booo!", $db_make); + } else{ + dba_insert(pack('i',129), "Booo!", $db_make); + } dba_close($db_make); // write md5 checksum of generated database file var_dump(md5_file($db_file)); diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt index e68e8b740..d8fde4b62 100644 --- a/ext/dba/tests/dba_gdbm.phpt +++ b/ext/dba/tests/dba_gdbm.phpt @@ -12,7 +12,7 @@ DBA GDBM handler test $lock_flag = ''; // lock in library require_once dirname(__FILE__) .'/dba_handler.inc'; - // Read during write is system dependant. Important is that there is no deadlock + // Read during write is system dependent. Important is that there is no deadlock ?> ===DONE=== --EXPECTF-- diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt index d3f0658c1..d5743bc6c 100644 --- a/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt +++ b/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt @@ -1,5 +1,5 @@ --TEST-- -DomDocument::schemaValidate() - non-existant schema file +DomDocument::schemaValidate() - non-existent schema file --CREDITS-- Daniel Convissor <danielc@php.net> # TestFest 2009 NYPHP @@ -12,14 +12,14 @@ $doc = new DOMDocument; $doc->load(dirname(__FILE__)."/book.xml"); -$result = $doc->schemaValidate(dirname(__FILE__)."/non-existant-file"); +$result = $doc->schemaValidate(dirname(__FILE__)."/non-existent-file"); var_dump($result); ?> --EXPECTF-- -Warning: DOMDocument::schemaValidate(): I/O warning : failed to load external entity "%snon-existant-file" in %s.php on line %d +Warning: DOMDocument::schemaValidate(): I/O warning : failed to load external entity "%snon-existent-file" in %s.php on line %d -Warning: DOMDocument::schemaValidate(): Failed to locate the main schema resource at '%s/non-existant-file'. in %s.php on line %d +Warning: DOMDocument::schemaValidate(): Failed to locate the main schema resource at '%s/non-existent-file'. in %s.php on line %d Warning: DOMDocument::schemaValidate(): Invalid Schema in %s.php on line %d bool(false) diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index 141192c67..98b5c9fd8 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -674,7 +674,7 @@ PHP_FUNCTION(enchant_broker_dict_exists) described/referred to by 'tag'. The ordering is a comma delimited list of provider names. As a special exception, the "*" tag can be used as a language tag to declare a default ordering for any - language that does not explictly declare an ordering. */ + language that does not explicitly declare an ordering. */ PHP_FUNCTION(enchant_broker_set_ordering) { diff --git a/ext/exif/exif.c b/ext/exif/exif.c index c69107589..bd646d9ad 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -2595,7 +2595,7 @@ static int exif_process_string_raw(char **result, char *value, size_t byte_count /* {{{ exif_process_string * Copy a string in Exif header to a character string and return length of allocated buffer if any. - * In contrast to exif_process_string this function does allways return a string buffer */ + * In contrast to exif_process_string this function does always return a string buffer */ static int exif_process_string(char **result, char *value, size_t byte_count TSRMLS_DC) { /* we cannot use strlcpy - here the problem is that we cannot use strlen to * determin length of string and we cannot use strlcpy with len=byte_count+1 diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c index 1e7dbf744..0671fa99f 100644 --- a/ext/fileinfo/libmagic/softmagic.c +++ b/ext/fileinfo/libmagic/softmagic.c @@ -1630,7 +1630,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m, /* Verify we have enough data to match magic type */ switch (m->type) { case FILE_BYTE: - if (nbytes < (offset + 1)) /* should alway be true */ + if (nbytes < (offset + 1)) /* should always be true */ return 0; break; diff --git a/ext/fileinfo/tests/magic b/ext/fileinfo/tests/magic index 27bde927e..374734d57 100644 --- a/ext/fileinfo/tests/magic +++ b/ext/fileinfo/tests/magic @@ -3303,7 +3303,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 #------------------------------------------------------------------------------ diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 4c8a94f81..bde4792a1 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -182,6 +182,7 @@ ftp_close(ftpbuf_t *ftp) #if HAVE_OPENSSL_EXT if (ftp->ssl_active) { SSL_shutdown(ftp->ssl_handle); + SSL_free(ftp->ssl_handle); } #endif closesocket(ftp->fd); @@ -297,6 +298,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC) if (SSL_connect(ftp->ssl_handle) <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL/TLS handshake failed"); SSL_shutdown(ftp->ssl_handle); + SSL_free(ftp->ssl_handle); return 0; } @@ -1548,6 +1550,7 @@ data_accepted: if (SSL_connect(data->ssl_handle) <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_accept: SSL/TLS handshake failed"); SSL_shutdown(data->ssl_handle); + SSL_free(data->ssl_handle); return 0; } @@ -1565,13 +1568,21 @@ data_accepted: databuf_t* data_close(ftpbuf_t *ftp, databuf_t *data) { +#if HAVE_OPENSSL_EXT + SSL_CTX *ctx; +#endif if (data == NULL) { return NULL; } if (data->listener != -1) { #if HAVE_OPENSSL_EXT if (data->ssl_active) { + + ctx = SSL_get_SSL_CTX(data->ssl_handle); + SSL_CTX_free(ctx); + SSL_shutdown(data->ssl_handle); + SSL_free(data->ssl_handle); data->ssl_active = 0; } #endif @@ -1580,7 +1591,11 @@ data_close(ftpbuf_t *ftp, databuf_t *data) if (data->fd != -1) { #if HAVE_OPENSSL_EXT if (data->ssl_active) { + ctx = SSL_get_SSL_CTX(data->ssl_handle); + SSL_CTX_free(ctx); + SSL_shutdown(data->ssl_handle); + SSL_free(data->ssl_handle); data->ssl_active = 0; } #endif diff --git a/ext/ftp/tests/ftp_fget_basic.phpt b/ext/ftp/tests/ftp_fget_basic.phpt index d736f8c45..355b8b846 100644 --- a/ext/ftp/tests/ftp_fget_basic.phpt +++ b/ext/ftp/tests/ftp_fget_basic.phpt @@ -27,7 +27,7 @@ var_dump(ftp_fget($ftp, $fp, 'binary data.bin', FTP_BINARY)); fseek($fp, $postition); var_dump(urlencode(fgets($fp))); -//test non-existant file request +//test non-existent file request ftp_fget($ftp, $fp ,'a warning.txt', FTP_ASCII); //remove file diff --git a/ext/ftp/tests/ftp_get_basic.phpt b/ext/ftp/tests/ftp_get_basic.phpt index 23fd8d07f..2fd8c7914 100644 --- a/ext/ftp/tests/ftp_get_basic.phpt +++ b/ext/ftp/tests/ftp_get_basic.phpt @@ -27,7 +27,7 @@ var_dump(ftp_get($ftp, $tmpfname, 'binary data.bin', FTP_BINARY)); var_dump(urlencode(file_get_contents($tmpfname))); unlink($tmpfname); -//test non-existant file request +//test non-existent file request ftp_get($ftp, $tmpfname ,'a warning.txt', FTP_ASCII); ?> --EXPECTF-- diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 4ebac94fc..8f32ad506 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -96,7 +96,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int, int); /* IMPORTANT NOTE FOR NEW FILTER * Do not forget to update: * IMAGE_FILTER_MAX: define the last filter index - * IMAGE_FILTER_MAX_ARGS: define the biggest amout of arguments + * IMAGE_FILTER_MAX_ARGS: define the biggest amount of arguments * image_filter array in PHP_FUNCTION(imagefilter) * */ #define IMAGE_FILTER_NEGATE 0 @@ -2361,30 +2361,12 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, } } + stream = php_stream_open_wrapper(file, "rb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL); if (stream == NULL) { RETURN_FALSE; } - ioctx_func_p = NULL; /* don't allow sockets without IOCtx */ - - if (image_type == PHP_GDIMG_TYPE_WEBP) { - size_t buff_size; - char *buff; - - /* needs to be malloc (persistent) - GD will free() it later */ - buff_size = php_stream_copy_to_mem(stream, &buff, PHP_STREAM_COPY_ALL, 1); - if (!buff_size) { - php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot read image data"); - goto out_err; - } - im = (*ioctx_func_p)(buff_size, buff); - if (!im) { - goto out_err; - } - goto register_im; - } - /* try and avoid allocating a FILE* if the stream is not naturally a FILE* */ if (php_stream_is(stream, PHP_STREAM_IS_STDIO)) { if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void**)&fp, REPORT_ERRORS)) { @@ -2419,7 +2401,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, io_ctx->gd_free(io_ctx); pefree(buff, 1); } - else { + else if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO)) { /* try and force the stream to be FILE* */ if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_STDIO | PHP_STREAM_CAST_TRY_HARD, (void **) &fp, REPORT_ERRORS)) { goto out_err; @@ -2496,11 +2478,11 @@ PHP_FUNCTION(imagecreatefrompng) #endif /* HAVE_GD_PNG */ #ifdef HAVE_GD_WEBP -/* {{{ proto resource imagecreatefrompng(string filename) - Create a new image from PNG file or URL */ +/* {{{ proto resource imagecreatefromwebp(string filename) + Create a new image from WEBP file or URL */ PHP_FUNCTION(imagecreatefromwebp) { - _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WEBP, "WEBP", gdImageCreateFromWebpPtr, gdImageCreateFromWebpPtr); + _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WEBP, "WEBP", gdImageCreateFromWebp, gdImageCreateFromWebpCtx); } /* }}} */ #endif /* HAVE_GD_VPX */ @@ -2736,7 +2718,7 @@ PHP_FUNCTION(imagepng) #ifdef HAVE_GD_WEBP /* {{{ proto bool imagewebp(resource im [, string filename[, quality]] ) - Output PNG image to browser or file */ + Output WEBP image to browser or file */ PHP_FUNCTION(imagewebp) { _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WEBP, "WEBP", gdImageWebpCtx); @@ -4965,7 +4947,7 @@ PHP_FUNCTION(imagecrop) zval *z_rect; zval **tmp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|a", &IM, &z_rect) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &IM, &z_rect) == FAILURE) { return; } diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 81eba52c8..7ed6617c5 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -3044,7 +3044,7 @@ int gdImagePaletteToTrueColor(gdImagePtr src) for (x = 0; x < sx; x++) { const unsigned char c = *(src_row + x); if (c == src->transparent) { - *(dst_row + x) = gdTrueColorAlpha(0, 0, 0, 127);; + *(dst_row + x) = gdTrueColorAlpha(0, 0, 0, 127); } else { *(dst_row + x) = gdTrueColorAlpha(src->red[c], src->green[c], src->blue[c], src->alpha[c]); } @@ -3061,6 +3061,12 @@ int gdImagePaletteToTrueColor(gdImagePtr src) src->pixels = NULL; src->alphaBlendingFlag = 0; src->saveAlphaFlag = 1; + + if (src->transparent >= 0) { + const unsigned char c = src->transparent; + src->transparent = gdTrueColorAlpha(src->red[c], src->green[c], src->blue[c], src->alpha[c]); + } + return 1; clean_on_error: diff --git a/ext/gd/libgd/gd_crop.c b/ext/gd/libgd/gd_crop.c index 9ce48273b..f0b888a4f 100644 --- a/ext/gd/libgd/gd_crop.c +++ b/ext/gd/libgd/gd_crop.c @@ -69,7 +69,7 @@ printf("rect->x: %i\nrect->y: %i\nrect->width: %i\nrect->height: %i\n", crop->x, if (src->trueColor) { unsigned int dst_y = 0; while (y < (crop->y + (crop->height - 1))) { - /* TODO: replace 4 w/byte per channel||pitch once avaiable */ + /* TODO: replace 4 w/byte per channel||pitch once available */ memcpy(dst->tpixels[dst_y++], src->tpixels[y++] + crop->x, crop->width * 4); } } else { diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index 9652a3a18..e3247a78c 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -1674,13 +1674,6 @@ gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, co unsigned int i; gdImagePtr dst; - /* impact perf a bit, but not that much. Implementation for palette - images can be done at a later point. - */ - if (src->trueColor == 0) { - gdImagePaletteToTrueColor(src); - } - dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { return NULL; @@ -1736,12 +1729,6 @@ gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int b f_slop_x > f_slop_y ? gd_divfx(f_slop_y, f_slop_x) : gd_divfx(f_slop_x, f_slop_y) : 0; - /* impact perf a bit, but not that much. Implementation for palette - images can be done at a later point. - */ - if (src->trueColor == 0) { - gdImagePaletteToTrueColor(src); - } dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { @@ -1796,13 +1783,6 @@ gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int unsigned int src_offset_x, src_offset_y; gdImagePtr dst; - /* impact perf a bit, but not that much. Implementation for palette - images can be done at a later point. - */ - if (src->trueColor == 0) { - gdImagePaletteToTrueColor(src); - } - dst = gdImageCreateTrueColor(new_width, new_height); if (dst == NULL) { return NULL; @@ -1922,13 +1902,6 @@ gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const unsigned int i; gdImagePtr dst; - /* impact perf a bit, but not that much. Implementation for palette - images can be done at a later point. - */ - if (src->trueColor == 0) { - gdImagePaletteToTrueColor(src); - } - dst = gdImageCreateTrueColor(new_width, new_height); if (dst == NULL) { @@ -2177,11 +2150,21 @@ gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor) { const int angle_rounded = (int)floor(angle * 100); - + if (bgcolor < 0) { return NULL; } + /* impact perf a bit, but not that much. Implementation for palette + images can be done at a later point. + */ + if (src->trueColor == 0) { + if (bgcolor >= 0) { + bgcolor = gdTrueColorAlpha(src->red[bgcolor], src->green[bgcolor], src->blue[bgcolor], src->alpha[bgcolor]); + } + gdImagePaletteToTrueColor(src); + } + /* no interpolation needed here */ switch (angle_rounded) { case 9000: diff --git a/ext/gd/libgd/gd_webp.c b/ext/gd/libgd/gd_webp.c index 889f5f10a..bf9ac9dd0 100644 --- a/ext/gd/libgd/gd_webp.c +++ b/ext/gd/libgd/gd_webp.c @@ -58,11 +58,13 @@ gdImagePtr gdImageCreateFromWebpPtr (int size, void *data) return im; } +#define GD_WEBP_ALLOC_STEP (4*1024) + gdImagePtr gdImageCreateFromWebpCtx (gdIOCtx * infile) { int width, height, ret; - unsigned char *filedata; - unsigned char dummy[1024]; + unsigned char *filedata = NULL; + unsigned char *read, *temp; unsigned char *Y = NULL; unsigned char *U = NULL; unsigned char *V = NULL; @@ -70,16 +72,25 @@ gdImagePtr gdImageCreateFromWebpCtx (gdIOCtx * infile) gdImagePtr im; do { - n = gdGetBuf(dummy, 1024, infile); - size += n; - } while (n != EOF); + temp = gdRealloc(filedata, size+GD_WEBP_ALLOC_STEP); + if (temp) { + filedata = temp; + read = temp + size; + } else { + if (filedata) { + gdFree(filedata); + } + php_gd_error("WebP decode: realloc failed"); + return NULL; + } + + n = gdGetBuf(read, GD_WEBP_ALLOC_STEP, infile); + /* differs from upstream where gdGetBuf return 0 instead of EOF */ + if (n>0 && n!=EOF) { + size += n; + } + } while (n>0 && n!=EOF); - filedata = gdMalloc(size); - if (!filedata) { - php_gd_error("WebP decode: alloc failed"); - return NULL; - } - gdGetBuf(filedata, size, infile); ret = WebPDecode(filedata, size, &Y, &U, &V, &width, &height); gdFree(filedata); if (ret != webp_success) { diff --git a/ext/gd/libgd/webpimg.h b/ext/gd/libgd/webpimg.h index 8a05429a7..db23de5bb 100644 --- a/ext/gd/libgd/webpimg.h +++ b/ext/gd/libgd/webpimg.h @@ -84,7 +84,7 @@ WebPResult WebPDecode(const uint8* data, * height. * 6. y_stride: The width (in bytes) of one row of Y data. This may not * match width if there is end of row padding (e.g., for 32 - * bit row aligment). + * bit row alignment). * 7. QP: the quantization parameter. This parameter controls the * compression vs quality tradeoff. Use smaller numbers for better * quality (compression will be lesser) and vice versa. 20 is a diff --git a/ext/gd/tests/imagecrop_auto.phpt b/ext/gd/tests/imagecrop_auto.phpt index c2b5177fb..1c1929d8e 100644 --- a/ext/gd/tests/imagecrop_auto.phpt +++ b/ext/gd/tests/imagecrop_auto.phpt @@ -57,6 +57,8 @@ $im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0); imagepng($im_crop, __DIR__ . "/crop_threshold.png");
var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop));
+
+@unlink(__DIR__ . "/crop_threshold.png");
?>
--EXPECT--
TC IMG_CROP_DEFAULT
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index c9da09b23..f8c3a0773 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -1333,6 +1333,7 @@ ZEND_FUNCTION(gmp_cmp) res = mpz_cmp_si(*gmpnum_a, Z_LVAL_PP(b_arg)); } else { res = mpz_cmp(*gmpnum_a, *gmpnum_b); + FREE_GMP_TEMP(temp_b); } FREE_GMP_TEMP(temp_a); diff --git a/ext/hash/tests/hash_file_error.phpt b/ext/hash/tests/hash_file_error.phpt index 326fbd51a..de7ce55b1 100644 --- a/ext/hash/tests/hash_file_error.phpt +++ b/ext/hash/tests/hash_file_error.phpt @@ -23,8 +23,8 @@ file_put_contents( $filename, 'The quick brown fox jumped over the lazy dog.' ); echo "\n-- Testing hash_file() function with an unknown algorithm --\n"; var_dump( hash_file( 'foobar', $filename ) ); -echo "\n-- Testing hash_file() function with a non-existant file --\n"; -var_dump( hash_file( 'md5', 'nonexistant.txt' ) ); +echo "\n-- Testing hash_file() function with a non-existent file --\n"; +var_dump( hash_file( 'md5', 'nonexistent.txt' ) ); echo "\n-- Testing hash_file() function with less than expected no. of arguments --\n"; var_dump( hash_file( 'md5' ) ); @@ -50,7 +50,7 @@ unlink( $filename ); Warning: hash_file(): Unknown hashing algorithm: %s in %s on line %d bool(false) --- Testing hash_file() function with a non-existant file -- +-- Testing hash_file() function with a non-existent file -- Warning: hash_file(%s): failed to open stream: No such file or directory in %s on line %d bool(false) diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index b154cb86b..d697fa791 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1270,7 +1270,6 @@ PHP_FUNCTION(imap_reopen) int mailbox_len; long options = 0, retries = 0; pils *imap_le_struct; - MAILSTREAM *imap_stream; long flags=NIL; long cl_flags=NIL; @@ -1298,12 +1297,12 @@ PHP_FUNCTION(imap_reopen) RETURN_FALSE; } - imap_stream = mail_open(imap_le_struct->imap_stream, mailbox, flags); - if (imap_stream == NIL) { + imap_le_struct->imap_stream = mail_open(imap_le_struct->imap_stream, mailbox, flags); + if (imap_le_struct->imap_stream == NIL) { + zend_list_delete(Z_RESVAL_P(streamind)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't re-open stream"); RETURN_FALSE; } - imap_le_struct->imap_stream = imap_stream; RETURN_TRUE; } /* }}} */ diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index beb65f718..e13425097 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -361,6 +361,10 @@ ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_setLenient, 0, 0, 1) ZEND_ARG_INFO(0, isLenient) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_set_minimal_days_in_first_week, 0, 0, 1) + ZEND_ARG_INFO(0, numberOfDays) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_from_date_time, 0, 0, 1) ZEND_ARG_INFO(0, dateTime) ZEND_END_ARG_INFO() @@ -433,6 +437,7 @@ static const zend_function_entry Calendar_class_functions[] = { #endif PHP_ME_MAPPING(setFirstDayOfWeek, intlcal_set_first_day_of_week, ainfo_cal_dow, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setLenient, intlcal_set_lenient, ainfo_cal_setLenient, ZEND_ACC_PUBLIC) + PHP_ME_MAPPING(setMinimalDaysInFirstWeek,intlcal_set_minimal_days_in_first_week,ainfo_cal_set_minimal_days_in_first_week,ZEND_ACC_PUBLIC) PHP_ME_MAPPING(equals, intlcal_equals, ainfo_cal_other_cal, ZEND_ACC_PUBLIC) #if U_ICU_VERSION_MAJOR_NUM >= 49 PHP_ME_MAPPING(getRepeatedWallTimeOption,intlcal_get_repeated_wall_time_option,ainfo_cal_void, ZEND_ACC_PUBLIC) @@ -523,7 +528,7 @@ void calendar_register_IntlCalendar_class(TSRMLS_D) CALENDAR_DECL_LONG_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY); CALENDAR_DECL_LONG_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY); CALENDAR_DECL_LONG_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH); - CALENDAR_DECL_LONG_CONST("FIELD_FIELD_COUNT ", UCAL_FIELD_COUNT); + CALENDAR_DECL_LONG_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT); CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH); CALENDAR_DECL_LONG_CONST("DOW_SUNDAY", UCAL_SUNDAY); diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 2d33bd195..db10502a1 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -997,6 +997,32 @@ U_CFUNC PHP_FUNCTION(intlcal_set_lenient) RETURN_TRUE; } +U_CFUNC PHP_FUNCTION(intlcal_set_minimal_days_in_first_week) +{ + long num_days; + CALENDAR_METHOD_INIT_VARS; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), + "Ol", &object, Calendar_ce_ptr, &num_days) == FAILURE) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_set_minimal_days_in_first_week: bad arguments", 0 TSRMLS_CC); + RETURN_FALSE; + } + + if (num_days < 1 || num_days > 7) { + intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, + "intlcal_set_minimal_days_in_first_week: invalid number of days; " + "must be between 1 and 7", 0 TSRMLS_CC); + RETURN_FALSE; + } + + CALENDAR_METHOD_FETCH_OBJECT; + + co->ucal->setMinimalDaysInFirstWeek((uint8_t)num_days); + + RETURN_TRUE; +} + U_CFUNC PHP_FUNCTION(intlcal_equals) { zval *other_object; diff --git a/ext/intl/calendar/calendar_methods.h b/ext/intl/calendar/calendar_methods.h index 2be13e492..dfd0bbeea 100644 --- a/ext/intl/calendar/calendar_methods.h +++ b/ext/intl/calendar/calendar_methods.h @@ -91,6 +91,8 @@ PHP_FUNCTION(intlcal_set_first_day_of_week); PHP_FUNCTION(intlcal_set_lenient); +PHP_FUNCTION(intlcal_set_minimal_days_in_first_week); + PHP_FUNCTION(intlcal_equals); PHP_FUNCTION(intlcal_get_repeated_wall_time_option); diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c index 475bbe418..8a094e015 100644 --- a/ext/intl/grapheme/grapheme_string.c +++ b/ext/intl/grapheme/grapheme_string.c @@ -113,7 +113,7 @@ PHP_FUNCTION(grapheme_strpos) unsigned char *found; long loffset = 0; int32_t offset = 0; - int ret_pos, uchar_pos; + int ret_pos; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { @@ -160,10 +160,10 @@ PHP_FUNCTION(grapheme_strpos) } /* do utf16 part of the strpos */ - ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, &uchar_pos, 0 /* fIgnoreCase */ TSRMLS_CC ); + ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* fIgnoreCase */, 0 /* last */ TSRMLS_CC ); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos + offset); + RETURN_LONG(ret_pos); } else { RETURN_FALSE; } @@ -180,7 +180,7 @@ PHP_FUNCTION(grapheme_stripos) unsigned char *found; long loffset = 0; int32_t offset = 0; - int ret_pos, uchar_pos; + int ret_pos; int is_ascii; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { @@ -235,10 +235,10 @@ PHP_FUNCTION(grapheme_stripos) } /* do utf16 part of the strpos */ - ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, &uchar_pos, 1 /* fIgnoreCase */ TSRMLS_CC ); + ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* fIgnoreCase */, 0 /*last */ TSRMLS_CC ); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos + offset); + RETURN_LONG(ret_pos); } else { RETURN_FALSE; } @@ -304,7 +304,7 @@ PHP_FUNCTION(grapheme_strrpos) /* else we need to continue via utf16 */ } - ret_pos = grapheme_strrpos_utf16(haystack, haystack_len, needle, needle_len, offset, 0 /* f_ignore_case */ TSRMLS_CC); + ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* f_ignore_case */, 1/* last */ TSRMLS_CC); if ( ret_pos >= 0 ) { RETURN_LONG(ret_pos); @@ -382,7 +382,7 @@ PHP_FUNCTION(grapheme_strripos) /* else we need to continue via utf16 */ } - ret_pos = grapheme_strrpos_utf16(haystack, haystack_len, needle, needle_len, offset, 1 /* f_ignore_case */ TSRMLS_CC); + ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* f_ignore_case */, 1 /*last */ TSRMLS_CC); if ( ret_pos >= 0 ) { RETURN_LONG(ret_pos); @@ -434,6 +434,7 @@ PHP_FUNCTION(grapheme_substr) grapheme_substr_ascii((char *)str, str_len, start, length, ZEND_NUM_ARGS(), (char **) &sub_str, &sub_str_len); if ( NULL == sub_str ) { + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: invalid parameters", 1 TSRMLS_CC ); RETURN_FALSE; } @@ -530,6 +531,15 @@ PHP_FUNCTION(grapheme_substr) RETURN_STRINGL(((char *)sub_str), sub_str_len, 0); } + if(length == 0) { + /* empty length - we've validated start, we can return "" now */ + if (ustr) { + efree(ustr); + } + ubrk_close(bi); + RETURN_EMPTY_STRING(); + } + /* find the end point of the string to return */ if ( length < 0 ) { @@ -554,25 +564,31 @@ PHP_FUNCTION(grapheme_substr) length += iter_val; } + ubrk_close(bi); + if ( UBRK_DONE == sub_str_end_pos) { if(length < 0) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: length not contained in string", 1 TSRMLS_CC ); efree(ustr); - ubrk_close(bi); RETURN_FALSE; } else { sub_str_end_pos = ustr_len; } } + + if(sub_str_start_pos > sub_str_end_pos) { + intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: length is beyond start", 1 TSRMLS_CC ); + + efree(ustr); + RETURN_FALSE; + } sub_str = NULL; status = U_ZERO_ERROR; intl_convert_utf16_to_utf8((char **)&sub_str, &sub_str_len, ustr + sub_str_start_pos, ( sub_str_end_pos - sub_str_start_pos ), &status); efree( ustr ); - ubrk_close( bi ); if ( U_FAILURE( status ) ) { /* Set global error code. */ @@ -643,7 +659,7 @@ static void strstr_common_handler(INTERNAL_FUNCTION_PARAMETERS, int f_ignore_cas } /* need to work in utf16 */ - ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, 0, &uchar_pos, f_ignore_case TSRMLS_CC ); + ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, 0, &uchar_pos, f_ignore_case, 0 /*last */ TSRMLS_CC ); if ( ret_pos < 0 ) { RETURN_FALSE; diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c index 92008554d..883fa0391 100644 --- a/ext/intl/grapheme/grapheme_util.c +++ b/ext/intl/grapheme/grapheme_util.c @@ -28,6 +28,7 @@ #include <unicode/ucol.h> #include <unicode/ustring.h> #include <unicode/ubrk.h> +#include <unicode/usearch.h> #include "ext/standard/php_string.h" @@ -47,49 +48,8 @@ grapheme_close_global_iterator( TSRMLS_D ) } /* }}} */ -/* {{{ grapheme_intl_case_fold: convert string to lowercase */ -void -grapheme_intl_case_fold(UChar** ptr_to_free, UChar **str, int32_t *str_len, UErrorCode *pstatus ) -{ - UChar *dest; - int32_t dest_len, size_required; - - /* allocate a destination string that is a bit larger than the src, hoping that is enough */ - dest_len = (*str_len) + ( *str_len / 10 ); - dest = (UChar*) eumalloc(dest_len); - - *pstatus = U_ZERO_ERROR; - size_required = u_strFoldCase(dest, dest_len, *str, *str_len, U_FOLD_CASE_DEFAULT, pstatus); - - dest_len = size_required; - - if ( U_BUFFER_OVERFLOW_ERROR == *pstatus ) { - - dest = (UChar*) eurealloc(dest, dest_len); - - *pstatus = U_ZERO_ERROR; - size_required = u_strFoldCase(dest, dest_len, *str, *str_len, U_FOLD_CASE_DEFAULT, pstatus); - } - - if ( U_FAILURE(*pstatus) ) { - return; - } - - if ( NULL != ptr_to_free) { - efree(*ptr_to_free); - *ptr_to_free = dest; - } - - *str = dest; - *str_len = dest_len; - - return; -} -/* }}} */ - /* {{{ grapheme_substr_ascii f='from' - starting point, l='length' */ -void -grapheme_substr_ascii(char *str, int str_len, int f, int l, int argc, char **sub_str, int *sub_str_len) +void grapheme_substr_ascii(char *str, int str_len, int f, int l, int argc, char **sub_str, int *sub_str_len) { *sub_str = NULL; @@ -147,225 +107,101 @@ grapheme_substr_ascii(char *str, int str_len, int f, int l, int argc, char **sub } /* }}} */ -/* {{{ grapheme_strrpos_utf16 - strrpos using utf16 */ -int -grapheme_strrpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int f_ignore_case TSRMLS_DC) -{ - UChar *uhaystack, *puhaystack, *uhaystack_end, *uneedle; - int32_t uhaystack_len, uneedle_len; - UErrorCode status; - unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE]; - UBreakIterator* bi = NULL; - int ret_pos, pos; - - /* convert the strings to UTF-16. */ - uhaystack = NULL; - uhaystack_len = 0; - status = U_ZERO_ERROR; - intl_convert_utf8_to_utf16(&uhaystack, &uhaystack_len, (char *) haystack, haystack_len, &status ); - - if ( U_FAILURE( status ) ) { - /* Set global error code. */ - intl_error_set_code( NULL, status TSRMLS_CC ); - - /* Set error messages. */ - intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC ); - if (uhaystack) { - efree( uhaystack ); - } - return -1; - } - - if ( f_ignore_case ) { - grapheme_intl_case_fold(&uhaystack, &uhaystack, &uhaystack_len, &status ); - } - - /* get a pointer to the haystack taking into account the offset */ - bi = NULL; - status = U_ZERO_ERROR; - bi = grapheme_get_break_iterator(u_break_iterator_buffer, &status TSRMLS_CC ); - - puhaystack = grapheme_get_haystack_offset(bi, uhaystack, uhaystack_len, offset); - - if ( NULL == puhaystack ) { - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Offset not contained in string", 1 TSRMLS_CC ); - if (uhaystack) { - efree( uhaystack ); - } - ubrk_close (bi); - return -1; - } - - uneedle = NULL; - uneedle_len = 0; - status = U_ZERO_ERROR; - intl_convert_utf8_to_utf16(&uneedle, &uneedle_len, (char *) needle, needle_len, &status ); - - if ( U_FAILURE( status ) ) { - /* Set global error code. */ - intl_error_set_code( NULL, status TSRMLS_CC ); - - /* Set error messages. */ - intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC ); - if (uhaystack) { - efree( uhaystack ); - } - if (uneedle) { - efree( uneedle ); - } - ubrk_close (bi); - return -1; - } - - if ( f_ignore_case ) { - grapheme_intl_case_fold(&uneedle, &uneedle, &uneedle_len, &status ); - } - - ret_pos = -1; /* -1 represents 'not found' */ - - /* back up until there's needle_len characters to compare */ - - uhaystack_end = uhaystack + uhaystack_len; - pos = ubrk_last(bi); - puhaystack = uhaystack + pos; - - while ( uhaystack_end - puhaystack < uneedle_len ) { - - pos = ubrk_previous(bi); - - if ( UBRK_DONE == pos ) { - break; - } - - puhaystack = uhaystack + pos; - } - - /* is there enough haystack left to hold the needle? */ - if ( ( uhaystack_end - puhaystack ) < uneedle_len ) { - /* not enough, not found */ - goto exit; - } - - while ( UBRK_DONE != pos ) { - - if (!u_memcmp(uneedle, puhaystack, uneedle_len)) { /* needle_len - 1 in zend memnstr? */ - - /* does the grapheme in the haystack end at the same place as the last grapheme in the needle? */ - - if ( ubrk_isBoundary(bi, pos + uneedle_len) ) { - - /* found it, get grapheme count offset */ - ret_pos = grapheme_count_graphemes(bi, uhaystack, pos); - break; - } - - /* set position back */ - ubrk_isBoundary(bi, pos); - } - - pos = ubrk_previous(bi); - puhaystack = uhaystack + pos; - } - -exit: - if (uhaystack) { - efree( uhaystack ); - } - if (uneedle) { - efree( uneedle ); +#define STRPOS_CHECK_STATUS(status, error) \ + if ( U_FAILURE( (status) ) ) { \ + intl_error_set_code( NULL, (status) TSRMLS_CC ); \ + intl_error_set_custom_msg( NULL, (error), 0 TSRMLS_CC ); \ + if (uhaystack) { \ + efree( uhaystack ); \ + } \ + if (uneedle) { \ + efree( uneedle ); \ + } \ + if(bi) { \ + ubrk_close (bi); \ + } \ + if(src) { \ + usearch_close(src); \ + } \ + return -1; \ } - ubrk_close (bi); - - return ret_pos; -} -/* }}} */ /* {{{ grapheme_strpos_utf16 - strrpos using utf16*/ -int -grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int32_t *puchar_pos, int f_ignore_case TSRMLS_DC) +int grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int32_t *puchar_pos, int f_ignore_case, int last TSRMLS_DC) { - UChar *uhaystack, *puhaystack, *uneedle; - int32_t uhaystack_len, uneedle_len; - int ret_pos; + UChar *uhaystack = NULL, *puhaystack, *uneedle = NULL; + int32_t uhaystack_len = 0, uneedle_len = 0, char_pos, ret_pos, offset_pos = 0; unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE]; - UBreakIterator* bi; + UBreakIterator* bi = NULL; UErrorCode status; + UStringSearch* src = NULL; + UCollator *coll; - *puchar_pos = -1; - + if(puchar_pos) { + *puchar_pos = -1; + } /* convert the strings to UTF-16. */ - uhaystack = NULL; - uhaystack_len = 0; status = U_ZERO_ERROR; intl_convert_utf8_to_utf16(&uhaystack, &uhaystack_len, (char *) haystack, haystack_len, &status ); + STRPOS_CHECK_STATUS(status, "Error converting input string to UTF-16"); - if ( U_FAILURE( status ) ) { - /* Set global error code. */ - intl_error_set_code( NULL, status TSRMLS_CC ); - - /* Set error messages. */ - intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC ); - if (uhaystack) { - efree( uhaystack ); - } - return -1; - } + status = U_ZERO_ERROR; + intl_convert_utf8_to_utf16(&uneedle, &uneedle_len, (char *) needle, needle_len, &status ); + STRPOS_CHECK_STATUS(status, "Error converting input string to UTF-16"); /* get a pointer to the haystack taking into account the offset */ - bi = NULL; status = U_ZERO_ERROR; bi = grapheme_get_break_iterator(u_break_iterator_buffer, &status TSRMLS_CC ); - - puhaystack = grapheme_get_haystack_offset(bi, uhaystack, uhaystack_len, offset); - uhaystack_len = (uhaystack_len - ( puhaystack - uhaystack)); + STRPOS_CHECK_STATUS(status, "Failed to get iterator"); + status = U_ZERO_ERROR; + ubrk_setText(bi, uhaystack, uhaystack_len, &status); + STRPOS_CHECK_STATUS(status, "Failed to set up iterator"); - if ( NULL == puhaystack ) { - - intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Offset not contained in string", 1 TSRMLS_CC ); - if (uhaystack) { - efree( uhaystack ); - } - ubrk_close (bi); - - return -1; - } + status = U_ZERO_ERROR; + src = usearch_open(uneedle, uneedle_len, uhaystack, uhaystack_len, "", bi, &status); + STRPOS_CHECK_STATUS(status, "Error creating search object"); - if ( f_ignore_case ) { - grapheme_intl_case_fold(&uhaystack, &puhaystack, &uhaystack_len, &status ); + if(f_ignore_case) { + coll = usearch_getCollator(src); + status = U_ZERO_ERROR; + ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_SECONDARY, &status); + STRPOS_CHECK_STATUS(status, "Error setting collation strength"); + usearch_reset(src); } - uneedle = NULL; - uneedle_len = 0; - status = U_ZERO_ERROR; - intl_convert_utf8_to_utf16(&uneedle, &uneedle_len, (char *) needle, needle_len, &status ); + if(offset != 0) { + offset_pos = grapheme_get_haystack_offset(bi, offset); + if(offset_pos == -1) { + status = U_ILLEGAL_ARGUMENT_ERROR; + STRPOS_CHECK_STATUS(status, "Invalid search offset"); + } + status = U_ZERO_ERROR; + usearch_setOffset(src, offset_pos, &status); + STRPOS_CHECK_STATUS(status, "Invalid search offset"); + } - if ( U_FAILURE( status ) ) { - /* Set global error code. */ - intl_error_set_code( NULL, status TSRMLS_CC ); - /* Set error messages. */ - intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 TSRMLS_CC ); - if (uhaystack) { - efree( uhaystack ); + if(last) { + char_pos = usearch_last(src, &status); + if(char_pos < offset_pos) { + /* last one is beyound our start offset */ + char_pos = USEARCH_DONE; } - if (uneedle) { - efree( uneedle ); - } - ubrk_close (bi); - - return -1; + } else { + char_pos = usearch_next(src, &status); } - - if ( f_ignore_case ) { - grapheme_intl_case_fold(&uneedle, &uneedle, &uneedle_len, &status ); + STRPOS_CHECK_STATUS(status, "Error looking up string"); + if(char_pos != USEARCH_DONE && ubrk_isBoundary(bi, char_pos)) { + ret_pos = grapheme_count_graphemes(bi, uhaystack,char_pos); + if(puchar_pos) { + *puchar_pos = char_pos; + } + } else { + ret_pos = -1; } - ret_pos = grapheme_memnstr_grapheme(bi, puhaystack, uneedle, uneedle_len, puhaystack + uhaystack_len ); - - *puchar_pos = ubrk_current(bi); - if (uhaystack) { efree( uhaystack ); } @@ -373,6 +209,7 @@ grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned ch efree( uneedle ); } ubrk_close (bi); + usearch_close (src); return ret_pos; } @@ -432,8 +269,7 @@ int grapheme_split_string(const UChar *text, int32_t text_length, int boundary_a /* }}} */ /* {{{ grapheme_count_graphemes */ -int32_t -grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t string_len) +int32_t grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t string_len) { int ret_len = 0; int pos = 0; @@ -455,85 +291,16 @@ grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t string_len) } /* }}} */ -/* {{{ grapheme_memnstr_grapheme: find needle in haystack using grapheme boundaries */ -int32_t -grapheme_memnstr_grapheme(UBreakIterator *bi, UChar *haystack, UChar *needle, int32_t needle_len, UChar *end) -{ - UChar *p = haystack; - UChar ne = needle[needle_len-1]; - UErrorCode status; - int32_t grapheme_offset; - - end -= needle_len; - - while (p <= end) { - - if ((p = u_memchr(p, *needle, (end-p+1))) && ne == p[needle_len-1]) { - - if (!u_memcmp(needle, p, needle_len - 1)) { /* needle_len - 1 works because if needle_len is 1, we've already tested the char */ - - /* does the grapheme end here? */ - - status = U_ZERO_ERROR; - ubrk_setText (bi, haystack, (end - haystack) + needle_len, &status); - - if ( ubrk_isBoundary (bi, (p - haystack) + needle_len) ) { - - /* found it, get grapheme count offset */ - grapheme_offset = grapheme_count_graphemes(bi, haystack, (p - haystack)); - - return grapheme_offset; - } - } - } - - if (p == NULL) { - return -1; - } - - p++; - } - - return -1; -} - -/* }}} */ - -/* {{{ grapheme_memrstr_grapheme: reverse find needle in haystack using grapheme boundaries */ -inline void *grapheme_memrchr_grapheme(const void *s, int c, int32_t n) -{ - register unsigned char *e; - - if (n <= 0) { - return NULL; - } - - for (e = (unsigned char *)s + n - 1; e >= (unsigned char *)s; e--) { - if (*e == (unsigned char)c) { - return (void *)e; - } - } - - return NULL; -} -/* }}} */ /* {{{ grapheme_get_haystack_offset - bump the haystack pointer based on the grapheme count offset */ -UChar * -grapheme_get_haystack_offset(UBreakIterator* bi, UChar *uhaystack, int32_t uhaystack_len, int32_t offset) +int grapheme_get_haystack_offset(UBreakIterator* bi, int32_t offset) { - UErrorCode status; int32_t pos; int32_t (*iter_op)(UBreakIterator* bi); int iter_incr; - if ( NULL != bi ) { - status = U_ZERO_ERROR; - ubrk_setText (bi, uhaystack, uhaystack_len, &status); - } - if ( 0 == offset ) { - return uhaystack; + return 0; } if ( offset < 0 ) { @@ -558,10 +325,10 @@ grapheme_get_haystack_offset(UBreakIterator* bi, UChar *uhaystack, int32_t uhays } if ( offset != 0 ) { - return NULL; + return -1; } - return uhaystack + pos; + return pos; } /* }}} */ @@ -607,8 +374,7 @@ grapheme_strrpos_ascii(unsigned char *haystack, int32_t haystack_len, unsigned c /* }}} */ /* {{{ grapheme_get_break_iterator: get a clone of the global character break iterator */ -UBreakIterator* -grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC ) +UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC ) { int32_t buffer_size; diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h index c91aeaff7..14f3f22c4 100644 --- a/ext/intl/grapheme/grapheme_util.h +++ b/ext/intl/grapheme/grapheme_util.h @@ -23,35 +23,25 @@ /* get_break_interator: get a break iterator from the global structure */ UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC ); -void -grapheme_substr_ascii(char *str, int32_t str_len, int32_t f, int32_t l, int argc, char **sub_str, int *sub_str_len); +void grapheme_substr_ascii(char *str, int32_t str_len, int32_t f, int32_t l, int argc, char **sub_str, int *sub_str_len); -int -grapheme_strrpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int f_ignore_case TSRMLS_DC); +int grapheme_strrpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int f_ignore_case TSRMLS_DC); -int -grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int *puchar_pos, int f_ignore_case TSRMLS_DC); +int grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int *puchar_pos, int f_ignore_case, int last TSRMLS_DC); int grapheme_ascii_check(const unsigned char *day, int32_t len); int grapheme_split_string(const UChar *text, int32_t text_length, int boundary_array[], int boundary_array_len TSRMLS_DC ); -int32_t -grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t string_len); - -int32_t -grapheme_memnstr_grapheme(UBreakIterator *bi, UChar *haystack, UChar *needle, int32_t needle_len, UChar *end); +int32_t grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t string_len); inline void *grapheme_memrchr_grapheme(const void *s, int c, int32_t n); -UChar * -grapheme_get_haystack_offset(UBreakIterator* bi, UChar *uhaystack, int32_t uhaystack_len, int32_t offset); +int grapheme_get_haystack_offset(UBreakIterator* bi, int32_t offset); -int32_t -grapheme_strrpos_ascii(unsigned char *haystack, int32_t haystack_len, unsigned char *needle, int32_t needle_len, int32_t offset); +int32_t grapheme_strrpos_ascii(unsigned char *haystack, int32_t haystack_len, unsigned char *needle, int32_t needle_len, int32_t offset); -UBreakIterator* -grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC ); +UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC ); /* OUTSIDE_STRING: check if (possibly negative) long offset is outside the string with int32_t length */ #define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (long) max_len : offset >= (long) max_len) ) diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index a2c4d7765..65e53c8b5 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -590,6 +590,11 @@ ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_lenient, 0, 0, 2 ) ZEND_ARG_INFO( 0, isLenient ) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_minimal_days_in_first_week, 0, 0, 2 ) + ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 ) + ZEND_ARG_INFO( 0, numberOfDays ) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_from_date_time, 0, 0, 1) ZEND_ARG_INFO(0, dateTime) ZEND_END_ARG_INFO() @@ -828,6 +833,7 @@ zend_function_entry intl_functions[] = { #endif PHP_FE( intlcal_set_first_day_of_week, ainfo_cal_dow ) PHP_FE( intlcal_set_lenient, ainfo_cal_set_lenient ) + PHP_FE( intlcal_set_minimal_days_in_first_week, ainfo_cal_set_minimal_days_in_first_week ) PHP_FE( intlcal_equals, ainfo_cal_other_cal ) PHP_FE( intlcal_from_date_time, ainfo_cal_from_date_time ) PHP_FE( intlcal_to_date_time, ainfo_cal_only_cal ) diff --git a/ext/intl/tests/bug61860.phpt b/ext/intl/tests/bug61860.phpt new file mode 100644 index 000000000..123d9ff23 --- /dev/null +++ b/ext/intl/tests/bug61860.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #61860: Offsets may be wrong for grapheme_stri* functions +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php +$haystack = 'Auf der Straße nach Paris habe ich mit dem Fahrer gesprochen'; +var_dump( + grapheme_stripos($haystack, 'pariS '), + grapheme_stristr($haystack, 'paRis '), + grapheme_substr($haystack, grapheme_stripos($haystack, 'Paris')) +); + +?> +--EXPECT-- +int(20) +string(40) "Paris habe ich mit dem Fahrer gesprochen" +string(40) "Paris habe ich mit dem Fahrer gesprochen" diff --git a/ext/intl/tests/bug62759.phpt b/ext/intl/tests/bug62759.phpt new file mode 100644 index 000000000..d4126b752 --- /dev/null +++ b/ext/intl/tests/bug62759.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #62759: Buggy grapheme_substr() on edge case +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php +var_dump(substr('deja', 1, -4)); +var_dump(substr('deja', -1, 0)); +var_dump(grapheme_substr('deja', 1, -4)); +var_dump(intl_get_error_message()); +var_dump(grapheme_substr('deja', -1, 0)); +var_dump(grapheme_substr('déjà', 1, -4)); +var_dump(intl_get_error_message()); +var_dump(grapheme_substr('déjà', -1, 0)); +?> +--EXPECT-- +bool(false) +string(0) "" +bool(false) +string(61) "grapheme_substr: invalid parameters: U_ILLEGAL_ARGUMENT_ERROR" +string(0) "" +bool(false) +string(65) "grapheme_substr: length is beyond start: U_ILLEGAL_ARGUMENT_ERROR" +string(0) "" diff --git a/ext/intl/tests/calendar_const_field_field_count.phpt b/ext/intl/tests/calendar_const_field_field_count.phpt new file mode 100644 index 000000000..bae438fbb --- /dev/null +++ b/ext/intl/tests/calendar_const_field_field_count.phpt @@ -0,0 +1,13 @@ +--TEST-- +IntlCalendar::FIELD_FIELD_COUNT +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +<?php +var_dump(IntlCalendar::FIELD_FIELD_COUNT); +--EXPECTF-- +int(%d) diff --git a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt new file mode 100644 index 000000000..998e74bc0 --- /dev/null +++ b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt @@ -0,0 +1,26 @@ +--TEST-- +IntlCalendar::setMinimalDaysInFirstWeek() basic test +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +<?php +ini_set("intl.error_level", E_WARNING); +ini_set("intl.default_locale", "nl"); + +$intlcal = IntlCalendar::createInstance('UTC'); +var_dump( + $intlcal->setMinimalDaysInFirstWeek(6), + $intlcal->getMinimalDaysInFirstWeek(), + intlcal_set_minimal_days_in_first_week($intlcal, 5), + $intlcal->getMinimalDaysInFirstWeek() +); +?> +==DONE== +--EXPECT-- +bool(true) +int(6) +bool(true) +int(5) +==DONE==
diff --git a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt new file mode 100644 index 000000000..c133558dd --- /dev/null +++ b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +IntlCalendar::setMinimalDaysInFirstWeek(): bad arguments +--INI-- +date.timezone=Atlantic/Azores +--SKIPIF-- +<?php +if (!extension_loaded('intl')) + die('skip intl extension not enabled'); +--FILE-- +<?php +ini_set("intl.error_level", E_WARNING); + +$c = new IntlGregorianCalendar(NULL, 'pt_PT'); + +var_dump($c->setMinimalDaysInFirstWeek()); +var_dump($c->setMinimalDaysInFirstWeek(1, 2)); +var_dump($c->setMinimalDaysInFirstWeek(0)); + +var_dump(intlcal_set_minimal_days_in_first_week($c, 0)); +var_dump(intlcal_set_minimal_days_in_first_week(1, 2)); + +--EXPECTF-- +Warning: IntlCalendar::setMinimalDaysInFirstWeek() expects exactly 1 parameter, 0 given in %s on line %d + +Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: bad arguments in %s on line %d +bool(false) + +Warning: IntlCalendar::setMinimalDaysInFirstWeek() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: bad arguments in %s on line %d +bool(false) + +Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: invalid number of days; must be between 1 and 7 in %s on line %d +bool(false) + +Warning: intlcal_set_minimal_days_in_first_week(): intlcal_set_minimal_days_in_first_week: invalid number of days; must be between 1 and 7 in %s on line %d +bool(false) + +Catchable fatal error: Argument 1 passed to intlcal_set_minimal_days_in_first_week() must be an instance of IntlCalendar, integer given in %s on line %d + diff --git a/ext/intl/tests/transliterator_create_error.phpt b/ext/intl/tests/transliterator_create_error.phpt index 31aef68fe..4f2d04ae7 100644 --- a/ext/intl/tests/transliterator_create_error.phpt +++ b/ext/intl/tests/transliterator_create_error.phpt @@ -6,15 +6,15 @@ Transliterator::create (error) <?php ini_set("intl.error_level", E_WARNING); -Transliterator::create("inexistant id"); +Transliterator::create("inexistent id"); echo intl_get_error_message(), "\n"; Transliterator::create("bad UTF-8 \x8F"); echo intl_get_error_message(), "\n"; echo "Done.\n"; --EXPECTF-- -Warning: Transliterator::create(): transliterator_create: unable to open ICU transliterator with id "inexistant id" in %s on line %d -transliterator_create: unable to open ICU transliterator with id "inexistant id": U_INVALID_ID +Warning: Transliterator::create(): transliterator_create: unable to open ICU transliterator with id "inexistent id" in %s on line %d +transliterator_create: unable to open ICU transliterator with id "inexistent id": U_INVALID_ID Warning: Transliterator::create(): String conversion of id to UTF-16 failed in %s on line %d String conversion of id to UTF-16 failed: U_INVALID_CHAR_FOUND diff --git a/ext/intl/tests/transliterator_transliterate_variant1.phpt b/ext/intl/tests/transliterator_transliterate_variant1.phpt index fc77a4e3a..dcd01efd4 100644 --- a/ext/intl/tests/transliterator_transliterate_variant1.phpt +++ b/ext/intl/tests/transliterator_transliterate_variant1.phpt @@ -13,7 +13,7 @@ echo transliterator_transliterate("\x8F", $str), "\n"; echo intl_get_error_message(), "\n"; class A { -function __toString() { return "inexistant id"; } +function __toString() { return "inexistent id"; } } echo transliterator_transliterate(new A(), $str), "\n"; @@ -29,9 +29,9 @@ Warning: transliterator_transliterate(): Could not create transliterator with ID String conversion of id to UTF-16 failed: U_INVALID_CHAR_FOUND -Warning: transliterator_transliterate(): transliterator_create: unable to open ICU transliterator with id "inexistant id" in %s on line %d +Warning: transliterator_transliterate(): transliterator_create: unable to open ICU transliterator with id "inexistent id" in %s on line %d -Warning: transliterator_transliterate(): Could not create transliterator with ID "inexistant id" (transliterator_create: unable to open ICU transliterator with id "inexistant id": U_INVALID_ID) in %s on line %d +Warning: transliterator_transliterate(): Could not create transliterator with ID "inexistent id" (transliterator_create: unable to open ICU transliterator with id "inexistent id": U_INVALID_ID) in %s on line %d -transliterator_create: unable to open ICU transliterator with id "inexistant id": U_INVALID_ID +transliterator_create: unable to open ICU transliterator with id "inexistent id": U_INVALID_ID Done. diff --git a/ext/ldap/tests/ldap_get_values_len_error.phpt b/ext/ldap/tests/ldap_get_values_len_error.phpt index 8caea1479..45f9031df 100644 --- a/ext/ldap/tests/ldap_get_values_len_error.phpt +++ b/ext/ldap/tests/ldap_get_values_len_error.phpt @@ -20,7 +20,7 @@ var_dump(ldap_get_values_len($link)); var_dump(ldap_get_values_len($link, $entry)); var_dump(ldap_get_values_len($link, $entry, "weirdAttribute", "Additional data")); -var_dump(ldap_get_values_len($link, $entry, "inexistantAttribute")); +var_dump(ldap_get_values_len($link, $entry, "inexistentAttribute")); ?> ===DONE=== --CLEAN-- diff --git a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt index 966612f65..c8c798582 100644 --- a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt +++ b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt @@ -35,7 +35,7 @@ function rebind_proc ($ds, $ldap_url) { $link = ldap_connect($host, $port); var_dump(ldap_set_rebind_proc($link)); var_dump(ldap_set_rebind_proc($link, "rebind_proc", "Additional data")); -var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistant")); +var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistent")); ?> ===DONE=== --EXPECTF-- @@ -45,6 +45,6 @@ bool(false) Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 3 given in %s on line %d bool(false) -Warning: ldap_set_rebind_proc(): Two arguments expected for 'rebind_proc_inexistant' to be a valid callback in %s on line %d +Warning: ldap_set_rebind_proc(): Two arguments expected for 'rebind_proc_inexistent' to be a valid callback in %s on line %d bool(false) ===DONE=== diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index ba81a95e5..3b50dd5ed 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -296,7 +296,7 @@ static const zend_function_entry mysql_functions[] = { #ifdef MYSQL_HAS_SET_CHARSET PHP_FE(mysql_set_charset, arginfo_mysql_set_charset) #endif - /* for downwards compatability */ + /* for downwards compatibility */ PHP_DEP_FALIAS(mysql, mysql_db_query, arginfo_mysql_db_query) PHP_DEP_FALIAS(mysql_fieldname, mysql_field_name, arginfo_mysql_field_name) PHP_DEP_FALIAS(mysql_fieldtable, mysql_field_table, arginfo_mysql_field_seek) diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 4dd1a409f..ad4e25c66 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -531,7 +531,7 @@ PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry *class_ #include "ext/mysqlnd/mysqlnd_reverse_api.h" static MYSQLND *mysqli_convert_zv_to_mysqlnd(zval * zv TSRMLS_DC) { - if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJCE_P(zv) == mysqli_link_class_entry) { + if (Z_TYPE_P(zv) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), mysqli_link_class_entry TSRMLS_CC)) { MY_MYSQL * mysql; MYSQLI_RESOURCE * my_res; mysqli_object * intern = (mysqli_object *)zend_object_store_get_object(zv TSRMLS_CC); diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 398c15919..c24b974de 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -562,7 +562,7 @@ PHP_FUNCTION(mysqli_query) MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; - MYSQL_RES *result; + MYSQL_RES *result = NULL; char *query = NULL; int query_len; long resultmode = MYSQLI_STORE_RESULT; @@ -833,7 +833,7 @@ PHP_FUNCTION(mysqli_reap_async_query) MY_MYSQL *mysql; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; - MYSQL_RES *result; + MYSQL_RES *result = NULL; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; diff --git a/ext/mysqli/tests/mysqli_driver.phpt b/ext/mysqli/tests/mysqli_driver.phpt index 4e266a053..023e4d229 100644 --- a/ext/mysqli/tests/mysqli_driver.phpt +++ b/ext/mysqli/tests/mysqli_driver.phpt @@ -53,7 +53,7 @@ require_once('skipifconnectfailure.inc'); } catch (mysqli_sql_exception $e) { $ok = true; if ('' == $e->getMessage()) - printf("[008] getMessage() has returned an emptry string.\n"); + printf("[008] getMessage() has returned an empty string.\n"); if ('' == $e->getCode()) printf("[009] getCode() has returned an empty string.\n"); if ('' == $e->getFile()) diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt index fa00ecda1..ac2e7c000 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt @@ -17,7 +17,7 @@ mysqli_fetch_assoc() - utf8 die("skip Looks like UTF8 is not available on the server"); if (strtolower($tmp['Charset']) !== 'utf8') - die("skip Not sure if UTF8 is available, cancelling the test"); + die("skip Not sure if UTF8 is available, canceling the test"); mysqli_free_result($res); @@ -28,7 +28,7 @@ mysqli_fetch_assoc() - utf8 die("skip Looks like UCS2 is not available on the server"); if (strtolower($tmp['Charset']) !== 'ucs2') - die("skip Not sure if UCS2 is available, cancelling the test"); + die("skip Not sure if UCS2 is available, canceling the test"); mysqli_free_result($res); mysqli_close($link); diff --git a/ext/mysqli/tests/mysqli_options.phpt b/ext/mysqli/tests/mysqli_options.phpt index 2f7986d3f..5daaa597f 100644 --- a/ext/mysqli/tests/mysqli_options.phpt +++ b/ext/mysqli/tests/mysqli_options.phpt @@ -12,7 +12,7 @@ require_once('skipifconnectfailure.inc'); $valid_options = array( MYSQLI_READ_DEFAULT_GROUP => "MYSQLI_READ_DEFAULT_GROUP", - MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAUTL_FILE", + MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAULT_FILE", MYSQLI_OPT_CONNECT_TIMEOUT => "MYSQLI_OPT_CONNECT_TIMEOUT", MYSQLI_OPT_LOCAL_INFILE => "MYSQLI_OPT_LOCAL_INFILE", MYSQLI_INIT_COMMAND => "MYSQLI_INIT_COMMAND", diff --git a/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt b/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt new file mode 100644 index 000000000..d7a78f1cf --- /dev/null +++ b/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt @@ -0,0 +1,50 @@ +--TEST-- +mysqli_stmt_prepare() +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once('skipifemb.inc'); +require_once('skipifconnectfailure.inc'); +?> +--FILE-- +<?php + require_once("connect.inc"); + + // Note: No SQL tests here! We can expand one of the *fetch() + // tests to a generic SQL test, if we ever need that. + // We would duplicate the SQL test cases if we have it here and in one of the + // fetch tests, because the fetch tests would have to call prepare/execute etc. + // anyway. + + $tmp = NULL; + $link = NULL; + + require('table.inc'); + + $cleanupIds = range(1000, 3007); + $model = 50; + + $params = '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'; + + + /* create a prepared statement */ + if ($stmt = $link->prepare("SHOW STATUS WHERE 1 = ? AND 1 IN {$params}")) { + + $stmt->bind_param('iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii', $model, $cleanupIds[0], $cleanupIds[1], $cleanupIds[2], $cleanupIds[3], $cleanupIds[4], $cleanupIds[5], $cleanupIds[6], $cleanupIds[7], $cleanupIds[8], $cleanupIds[9], $cleanupIds[10], $cleanupIds[11], $cleanupIds[12], $cleanupIds[13], $cleanupIds[14], $cleanupIds[15], $cleanupIds[16], $cleanupIds[17], $cleanupIds[18], $cleanupIds[19], $cleanupIds[20], $cleanupIds[21], $cleanupIds[22], $cleanupIds[23], $cleanupIds[24], $cleanupIds[25], $cleanupIds[26], $cleanupIds[27], $cleanupIds[28], $cleanupIds[29], $cleanupIds[30], $cleanupIds[31], $cleanupIds[32], $cleanupIds[33], $cleanupIds[34], $cleanupIds[35], $cleanupIds[36], $cleanupIds[37], $cleanupIds[38], $cleanupIds[39], $cleanupIds[40], $cleanupIds[41], $cleanupIds[42], $cleanupIds[43], $cleanupIds[44], $cleanupIds[45], $cleanupIds[46], $cleanupIds[47], $cleanupIds[48], $cleanupIds[49], $cleanupIds[50], $cleanupIds[51], $cleanupIds[52], $cleanupIds[53], $cleanupIds[54], $cleanupIds[55], $cleanupIds[56], $cleanupIds[57], $cleanupIds[58], $cleanupIds[59], $cleanupIds[60], $cleanupIds[61], $cleanupIds[62], $cleanupIds[63], $cleanupIds[64], $cleanupIds[65], $cleanupIds[66], $cleanupIds[67], $cleanupIds[68], $cleanupIds[69], $cleanupIds[70], $cleanupIds[71], $cleanupIds[72], $cleanupIds[73], $cleanupIds[74], $cleanupIds[75], $cleanupIds[76], $cleanupIds[77], $cleanupIds[78], $cleanupIds[79], $cleanupIds[80], $cleanupIds[81], $cleanupIds[82], $cleanupIds[83], $cleanupIds[84], $cleanupIds[85], $cleanupIds[86], $cleanupIds[87], $cleanupIds[88], $cleanupIds[89], $cleanupIds[90], $cleanupIds[91], $cleanupIds[92], $cleanupIds[93], $cleanupIds[94], $cleanupIds[95], $cleanupIds[96], $cleanupIds[97], $cleanupIds[98], $cleanupIds[99], $cleanupIds[100], $cleanupIds[101], $cleanupIds[102], $cleanupIds[103], $cleanupIds[104], $cleanupIds[105], $cleanupIds[106], $cleanupIds[107], $cleanupIds[108], $cleanupIds[109], $cleanupIds[110], $cleanupIds[111], $cleanupIds[112], $cleanupIds[113], $cleanupIds[114], $cleanupIds[115], $cleanupIds[116], $cleanupIds[117], $cleanupIds[118], $cleanupIds[119], $cleanupIds[120], $cleanupIds[121], $cleanupIds[122], $cleanupIds[123], $cleanupIds[124], $cleanupIds[125], $cleanupIds[126], $cleanupIds[127], $cleanupIds[128], $cleanupIds[129], $cleanupIds[130], $cleanupIds[131], $cleanupIds[132], $cleanupIds[133], $cleanupIds[134], $cleanupIds[135], $cleanupIds[136], $cleanupIds[137], $cleanupIds[138], $cleanupIds[139], $cleanupIds[140], $cleanupIds[141], $cleanupIds[142], $cleanupIds[143], $cleanupIds[144], $cleanupIds[145], $cleanupIds[146], $cleanupIds[147], $cleanupIds[148], $cleanupIds[149], $cleanupIds[150], $cleanupIds[151], $cleanupIds[152], $cleanupIds[153], $cleanupIds[154], $cleanupIds[155], $cleanupIds[156], $cleanupIds[157], $cleanupIds[158], $cleanupIds[159], $cleanupIds[160], $cleanupIds[161], $cleanupIds[162], $cleanupIds[163], $cleanupIds[164], $cleanupIds[165], $cleanupIds[166], $cleanupIds[167], $cleanupIds[168], $cleanupIds[169], $cleanupIds[170], $cleanupIds[171], $cleanupIds[172], $cleanupIds[173], $cleanupIds[174], $cleanupIds[175], $cleanupIds[176], $cleanupIds[177], $cleanupIds[178], $cleanupIds[179], $cleanupIds[180], $cleanupIds[181], $cleanupIds[182], $cleanupIds[183], $cleanupIds[184], $cleanupIds[185], $cleanupIds[186], $cleanupIds[187], $cleanupIds[188], $cleanupIds[189], $cleanupIds[190], $cleanupIds[191], $cleanupIds[192], $cleanupIds[193], $cleanupIds[194], $cleanupIds[195], $cleanupIds[196], $cleanupIds[197], $cleanupIds[198], $cleanupIds[199], $cleanupIds[200], $cleanupIds[201], $cleanupIds[202], $cleanupIds[203], $cleanupIds[204], $cleanupIds[205], $cleanupIds[206], $cleanupIds[207], $cleanupIds[208], $cleanupIds[209], $cleanupIds[210], $cleanupIds[211], $cleanupIds[212], $cleanupIds[213], $cleanupIds[214], $cleanupIds[215], $cleanupIds[216], $cleanupIds[217], $cleanupIds[218], $cleanupIds[219], $cleanupIds[220], $cleanupIds[221], $cleanupIds[222], $cleanupIds[223], $cleanupIds[224], $cleanupIds[225], $cleanupIds[226], $cleanupIds[227], $cleanupIds[228], $cleanupIds[229], $cleanupIds[230], $cleanupIds[231], $cleanupIds[232], $cleanupIds[233], $cleanupIds[234], $cleanupIds[235], $cleanupIds[236], $cleanupIds[237], $cleanupIds[238], $cleanupIds[239], $cleanupIds[240], $cleanupIds[241], $cleanupIds[242], $cleanupIds[243], $cleanupIds[244], $cleanupIds[245], $cleanupIds[246], $cleanupIds[247], $cleanupIds[248], $cleanupIds[249], $cleanupIds[250], $cleanupIds[251], $cleanupIds[252], $cleanupIds[253], $cleanupIds[254], $cleanupIds[255], $cleanupIds[256], $cleanupIds[257], $cleanupIds[258], $cleanupIds[259], $cleanupIds[260], $cleanupIds[261], $cleanupIds[262], $cleanupIds[263], $cleanupIds[264], $cleanupIds[265], $cleanupIds[266], $cleanupIds[267], $cleanupIds[268], $cleanupIds[269], $cleanupIds[270], $cleanupIds[271], $cleanupIds[272], $cleanupIds[273], $cleanupIds[274], $cleanupIds[275], $cleanupIds[276], $cleanupIds[277], $cleanupIds[278], $cleanupIds[279], $cleanupIds[280], $cleanupIds[281], $cleanupIds[282], $cleanupIds[283], $cleanupIds[284], $cleanupIds[285], $cleanupIds[286], $cleanupIds[287], $cleanupIds[288], $cleanupIds[289], $cleanupIds[290], $cleanupIds[291], $cleanupIds[292], $cleanupIds[293], $cleanupIds[294], $cleanupIds[295], $cleanupIds[296], $cleanupIds[297], $cleanupIds[298], $cleanupIds[299], $cleanupIds[300], $cleanupIds[301], $cleanupIds[302], $cleanupIds[303], $cleanupIds[304], $cleanupIds[305], $cleanupIds[306], $cleanupIds[307], $cleanupIds[308], $cleanupIds[309], $cleanupIds[310], $cleanupIds[311], $cleanupIds[312], $cleanupIds[313], $cleanupIds[314], $cleanupIds[315], $cleanupIds[316], $cleanupIds[317], $cleanupIds[318], $cleanupIds[319], $cleanupIds[320], $cleanupIds[321], $cleanupIds[322], $cleanupIds[323], $cleanupIds[324], $cleanupIds[325], $cleanupIds[326], $cleanupIds[327], $cleanupIds[328], $cleanupIds[329], $cleanupIds[330], $cleanupIds[331], $cleanupIds[332], $cleanupIds[333], $cleanupIds[334], $cleanupIds[335], $cleanupIds[336], $cleanupIds[337], $cleanupIds[338], $cleanupIds[339], $cleanupIds[340], $cleanupIds[341], $cleanupIds[342], $cleanupIds[343], $cleanupIds[344], $cleanupIds[345], $cleanupIds[346], $cleanupIds[347], $cleanupIds[348], $cleanupIds[349], $cleanupIds[350], $cleanupIds[351], $cleanupIds[352], $cleanupIds[353], $cleanupIds[354], $cleanupIds[355], $cleanupIds[356], $cleanupIds[357], $cleanupIds[358], $cleanupIds[359], $cleanupIds[360], $cleanupIds[361], $cleanupIds[362], $cleanupIds[363], $cleanupIds[364], $cleanupIds[365], $cleanupIds[366], $cleanupIds[367], $cleanupIds[368], $cleanupIds[369], $cleanupIds[370], $cleanupIds[371], $cleanupIds[372], $cleanupIds[373], $cleanupIds[374], $cleanupIds[375], $cleanupIds[376], $cleanupIds[377], $cleanupIds[378], $cleanupIds[379], $cleanupIds[380], $cleanupIds[381], $cleanupIds[382], $cleanupIds[383], $cleanupIds[384], $cleanupIds[385], $cleanupIds[386], $cleanupIds[387], $cleanupIds[388], $cleanupIds[389], $cleanupIds[390], $cleanupIds[391], $cleanupIds[392], $cleanupIds[393], $cleanupIds[394], $cleanupIds[395], $cleanupIds[396], $cleanupIds[397], $cleanupIds[398], $cleanupIds[399], $cleanupIds[400], $cleanupIds[401], $cleanupIds[402], $cleanupIds[403], $cleanupIds[404], $cleanupIds[405], $cleanupIds[406], $cleanupIds[407], $cleanupIds[408], $cleanupIds[409], $cleanupIds[410], $cleanupIds[411], $cleanupIds[412], $cleanupIds[413], $cleanupIds[414], $cleanupIds[415], $cleanupIds[416], $cleanupIds[417], $cleanupIds[418], $cleanupIds[419], $cleanupIds[420], $cleanupIds[421], $cleanupIds[422], $cleanupIds[423], $cleanupIds[424], $cleanupIds[425], $cleanupIds[426], $cleanupIds[427], $cleanupIds[428], $cleanupIds[429], $cleanupIds[430], $cleanupIds[431], $cleanupIds[432], $cleanupIds[433], $cleanupIds[434], $cleanupIds[435], $cleanupIds[436], $cleanupIds[437], $cleanupIds[438], $cleanupIds[439], $cleanupIds[440], $cleanupIds[441], $cleanupIds[442], $cleanupIds[443], $cleanupIds[444], $cleanupIds[445], $cleanupIds[446], $cleanupIds[447], $cleanupIds[448], $cleanupIds[449], $cleanupIds[450], $cleanupIds[451], $cleanupIds[452], $cleanupIds[453], $cleanupIds[454], $cleanupIds[455], $cleanupIds[456], $cleanupIds[457], $cleanupIds[458], $cleanupIds[459], $cleanupIds[460], $cleanupIds[461], $cleanupIds[462], $cleanupIds[463], $cleanupIds[464], $cleanupIds[465], $cleanupIds[466], $cleanupIds[467], $cleanupIds[468], $cleanupIds[469], $cleanupIds[470], $cleanupIds[471], $cleanupIds[472], $cleanupIds[473], $cleanupIds[474], $cleanupIds[475], $cleanupIds[476], $cleanupIds[477], $cleanupIds[478], $cleanupIds[479], $cleanupIds[480], $cleanupIds[481], $cleanupIds[482], $cleanupIds[483], $cleanupIds[484], $cleanupIds[485], $cleanupIds[486], $cleanupIds[487], $cleanupIds[488], $cleanupIds[489], $cleanupIds[490], $cleanupIds[491], $cleanupIds[492], $cleanupIds[493], $cleanupIds[494], $cleanupIds[495], $cleanupIds[496], $cleanupIds[497], $cleanupIds[498], $cleanupIds[499], $cleanupIds[500], $cleanupIds[501], $cleanupIds[502], $cleanupIds[503], $cleanupIds[504], $cleanupIds[505], $cleanupIds[506], $cleanupIds[507], $cleanupIds[508], $cleanupIds[509], $cleanupIds[510], $cleanupIds[511], $cleanupIds[512], $cleanupIds[513], $cleanupIds[514], $cleanupIds[515], $cleanupIds[516], $cleanupIds[517], $cleanupIds[518], $cleanupIds[519], $cleanupIds[520], $cleanupIds[521], $cleanupIds[522], $cleanupIds[523], $cleanupIds[524], $cleanupIds[525], $cleanupIds[526], $cleanupIds[527], $cleanupIds[528], $cleanupIds[529], $cleanupIds[530], $cleanupIds[531], $cleanupIds[532], $cleanupIds[533], $cleanupIds[534], $cleanupIds[535], $cleanupIds[536], $cleanupIds[537], $cleanupIds[538], $cleanupIds[539], $cleanupIds[540], $cleanupIds[541], $cleanupIds[542], $cleanupIds[543], $cleanupIds[544], $cleanupIds[545], $cleanupIds[546], $cleanupIds[547], $cleanupIds[548], $cleanupIds[549], $cleanupIds[550], $cleanupIds[551], $cleanupIds[552], $cleanupIds[553], $cleanupIds[554], $cleanupIds[555], $cleanupIds[556], $cleanupIds[557], $cleanupIds[558], $cleanupIds[559], $cleanupIds[560], $cleanupIds[561], $cleanupIds[562], $cleanupIds[563], $cleanupIds[564], $cleanupIds[565], $cleanupIds[566], $cleanupIds[567], $cleanupIds[568], $cleanupIds[569], $cleanupIds[570], $cleanupIds[571], $cleanupIds[572], $cleanupIds[573], $cleanupIds[574], $cleanupIds[575], $cleanupIds[576], $cleanupIds[577], $cleanupIds[578], $cleanupIds[579], $cleanupIds[580], $cleanupIds[581], $cleanupIds[582], $cleanupIds[583], $cleanupIds[584], $cleanupIds[585], $cleanupIds[586], $cleanupIds[587], $cleanupIds[588], $cleanupIds[589], $cleanupIds[590], $cleanupIds[591], $cleanupIds[592], $cleanupIds[593], $cleanupIds[594], $cleanupIds[595], $cleanupIds[596], $cleanupIds[597], $cleanupIds[598], $cleanupIds[599], $cleanupIds[600], $cleanupIds[601], $cleanupIds[602], $cleanupIds[603], $cleanupIds[604], $cleanupIds[605], $cleanupIds[606], $cleanupIds[607], $cleanupIds[608], $cleanupIds[609], $cleanupIds[610], $cleanupIds[611], $cleanupIds[612], $cleanupIds[613], $cleanupIds[614], $cleanupIds[615], $cleanupIds[616], $cleanupIds[617], $cleanupIds[618], $cleanupIds[619], $cleanupIds[620], $cleanupIds[621], $cleanupIds[622], $cleanupIds[623], $cleanupIds[624], $cleanupIds[625], $cleanupIds[626], $cleanupIds[627], $cleanupIds[628], $cleanupIds[629], $cleanupIds[630], $cleanupIds[631], $cleanupIds[632], $cleanupIds[633], $cleanupIds[634], $cleanupIds[635], $cleanupIds[636], $cleanupIds[637], $cleanupIds[638], $cleanupIds[639], $cleanupIds[640], $cleanupIds[641], $cleanupIds[642], $cleanupIds[643], $cleanupIds[644], $cleanupIds[645], $cleanupIds[646], $cleanupIds[647], $cleanupIds[648], $cleanupIds[649], $cleanupIds[650], $cleanupIds[651], $cleanupIds[652], $cleanupIds[653], $cleanupIds[654], $cleanupIds[655], $cleanupIds[656], $cleanupIds[657], $cleanupIds[658], $cleanupIds[659], $cleanupIds[660], $cleanupIds[661], $cleanupIds[662], $cleanupIds[663], $cleanupIds[664], $cleanupIds[665], $cleanupIds[666], $cleanupIds[667], $cleanupIds[668], $cleanupIds[669], $cleanupIds[670], $cleanupIds[671], $cleanupIds[672], $cleanupIds[673], $cleanupIds[674], $cleanupIds[675], $cleanupIds[676], $cleanupIds[677], $cleanupIds[678], $cleanupIds[679], $cleanupIds[680], $cleanupIds[681], $cleanupIds[682], $cleanupIds[683], $cleanupIds[684], $cleanupIds[685], $cleanupIds[686], $cleanupIds[687], $cleanupIds[688], $cleanupIds[689], $cleanupIds[690], $cleanupIds[691], $cleanupIds[692], $cleanupIds[693], $cleanupIds[694], $cleanupIds[695], $cleanupIds[696], $cleanupIds[697], $cleanupIds[698], $cleanupIds[699], $cleanupIds[700], $cleanupIds[701], $cleanupIds[702], $cleanupIds[703], $cleanupIds[704], $cleanupIds[705], $cleanupIds[706], $cleanupIds[707], $cleanupIds[708], $cleanupIds[709], $cleanupIds[710], $cleanupIds[711], $cleanupIds[712], $cleanupIds[713], $cleanupIds[714], $cleanupIds[715], $cleanupIds[716], $cleanupIds[717], $cleanupIds[718], $cleanupIds[719], $cleanupIds[720], $cleanupIds[721], $cleanupIds[722], $cleanupIds[723], $cleanupIds[724], $cleanupIds[725], $cleanupIds[726], $cleanupIds[727], $cleanupIds[728], $cleanupIds[729], $cleanupIds[730], $cleanupIds[731], $cleanupIds[732], $cleanupIds[733], $cleanupIds[734], $cleanupIds[735], $cleanupIds[736], $cleanupIds[737], $cleanupIds[738], $cleanupIds[739], $cleanupIds[740], $cleanupIds[741], $cleanupIds[742], $cleanupIds[743], $cleanupIds[744], $cleanupIds[745], $cleanupIds[746], $cleanupIds[747], $cleanupIds[748], $cleanupIds[749], $cleanupIds[750], $cleanupIds[751], $cleanupIds[752], $cleanupIds[753], $cleanupIds[754], $cleanupIds[755], $cleanupIds[756], $cleanupIds[757], $cleanupIds[758], $cleanupIds[759], $cleanupIds[760], $cleanupIds[761], $cleanupIds[762], $cleanupIds[763], $cleanupIds[764], $cleanupIds[765], $cleanupIds[766], $cleanupIds[767], $cleanupIds[768], $cleanupIds[769], $cleanupIds[770], $cleanupIds[771], $cleanupIds[772], $cleanupIds[773], $cleanupIds[774], $cleanupIds[775], $cleanupIds[776], $cleanupIds[777], $cleanupIds[778], $cleanupIds[779], $cleanupIds[780], $cleanupIds[781], $cleanupIds[782], $cleanupIds[783], $cleanupIds[784], $cleanupIds[785], $cleanupIds[786], $cleanupIds[787], $cleanupIds[788], $cleanupIds[789], $cleanupIds[790], $cleanupIds[791], $cleanupIds[792], $cleanupIds[793], $cleanupIds[794], $cleanupIds[795], $cleanupIds[796], $cleanupIds[797], $cleanupIds[798], $cleanupIds[799], $cleanupIds[800], $cleanupIds[801], $cleanupIds[802], $cleanupIds[803], $cleanupIds[804], $cleanupIds[805], $cleanupIds[806], $cleanupIds[807], $cleanupIds[808], $cleanupIds[809], $cleanupIds[810], $cleanupIds[811], $cleanupIds[812], $cleanupIds[813], $cleanupIds[814], $cleanupIds[815], $cleanupIds[816], $cleanupIds[817], $cleanupIds[818], $cleanupIds[819], $cleanupIds[820], $cleanupIds[821], $cleanupIds[822], $cleanupIds[823], $cleanupIds[824], $cleanupIds[825], $cleanupIds[826], $cleanupIds[827], $cleanupIds[828], $cleanupIds[829], $cleanupIds[830], $cleanupIds[831], $cleanupIds[832], $cleanupIds[833], $cleanupIds[834], $cleanupIds[835], $cleanupIds[836], $cleanupIds[837], $cleanupIds[838], $cleanupIds[839], $cleanupIds[840], $cleanupIds[841], $cleanupIds[842], $cleanupIds[843], $cleanupIds[844], $cleanupIds[845], $cleanupIds[846], $cleanupIds[847], $cleanupIds[848], $cleanupIds[849], $cleanupIds[850], $cleanupIds[851], $cleanupIds[852], $cleanupIds[853], $cleanupIds[854], $cleanupIds[855], $cleanupIds[856], $cleanupIds[857], $cleanupIds[858], $cleanupIds[859], $cleanupIds[860], $cleanupIds[861], $cleanupIds[862], $cleanupIds[863], $cleanupIds[864], $cleanupIds[865], $cleanupIds[866], $cleanupIds[867], $cleanupIds[868], $cleanupIds[869], $cleanupIds[870], $cleanupIds[871], $cleanupIds[872], $cleanupIds[873], $cleanupIds[874], $cleanupIds[875], $cleanupIds[876], $cleanupIds[877], $cleanupIds[878], $cleanupIds[879], $cleanupIds[880], $cleanupIds[881], $cleanupIds[882], $cleanupIds[883], $cleanupIds[884], $cleanupIds[885], $cleanupIds[886], $cleanupIds[887], $cleanupIds[888], $cleanupIds[889], $cleanupIds[890], $cleanupIds[891], $cleanupIds[892], $cleanupIds[893], $cleanupIds[894], $cleanupIds[895], $cleanupIds[896], $cleanupIds[897], $cleanupIds[898], $cleanupIds[899], $cleanupIds[900], $cleanupIds[901], $cleanupIds[902], $cleanupIds[903], $cleanupIds[904], $cleanupIds[905], $cleanupIds[906], $cleanupIds[907], $cleanupIds[908], $cleanupIds[909], $cleanupIds[910], $cleanupIds[911], $cleanupIds[912], $cleanupIds[913], $cleanupIds[914], $cleanupIds[915], $cleanupIds[916], $cleanupIds[917], $cleanupIds[918], $cleanupIds[919], $cleanupIds[920], $cleanupIds[921], $cleanupIds[922], $cleanupIds[923], $cleanupIds[924], $cleanupIds[925], $cleanupIds[926], $cleanupIds[927], $cleanupIds[928], $cleanupIds[929], $cleanupIds[930], $cleanupIds[931], $cleanupIds[932], $cleanupIds[933], $cleanupIds[934], $cleanupIds[935], $cleanupIds[936], $cleanupIds[937], $cleanupIds[938], $cleanupIds[939], $cleanupIds[940], $cleanupIds[941], $cleanupIds[942], $cleanupIds[943], $cleanupIds[944], $cleanupIds[945], $cleanupIds[946], $cleanupIds[947], $cleanupIds[948], $cleanupIds[949], $cleanupIds[950], $cleanupIds[951], $cleanupIds[952], $cleanupIds[953], $cleanupIds[954], $cleanupIds[955], $cleanupIds[956], $cleanupIds[957], $cleanupIds[958], $cleanupIds[959], $cleanupIds[960], $cleanupIds[961], $cleanupIds[962], $cleanupIds[963], $cleanupIds[964], $cleanupIds[965], $cleanupIds[966], $cleanupIds[967], $cleanupIds[968], $cleanupIds[969], $cleanupIds[970], $cleanupIds[971], $cleanupIds[972], $cleanupIds[973], $cleanupIds[974], $cleanupIds[975], $cleanupIds[976], $cleanupIds[977], $cleanupIds[978], $cleanupIds[979], $cleanupIds[980], $cleanupIds[981], $cleanupIds[982], $cleanupIds[983], $cleanupIds[984], $cleanupIds[985], $cleanupIds[986], $cleanupIds[987], $cleanupIds[988], $cleanupIds[989], $cleanupIds[990], $cleanupIds[991], $cleanupIds[992], $cleanupIds[993], $cleanupIds[994], $cleanupIds[995], $cleanupIds[996], $cleanupIds[997], $cleanupIds[998], $cleanupIds[999], $cleanupIds[1000], $cleanupIds[1001], $cleanupIds[1002], $cleanupIds[1003], $cleanupIds[1004], $cleanupIds[1005], $cleanupIds[1006], $cleanupIds[1007], $cleanupIds[1008], $cleanupIds[1009], $cleanupIds[1010], $cleanupIds[1011], $cleanupIds[1012], $cleanupIds[1013], $cleanupIds[1014], $cleanupIds[1015], $cleanupIds[1016], $cleanupIds[1017], $cleanupIds[1018], $cleanupIds[1019], $cleanupIds[1020], $cleanupIds[1021], $cleanupIds[1022], $cleanupIds[1023], $cleanupIds[1024], $cleanupIds[1025], $cleanupIds[1026], $cleanupIds[1027], $cleanupIds[1028], $cleanupIds[1029], $cleanupIds[1030], $cleanupIds[1031], $cleanupIds[1032], $cleanupIds[1033], $cleanupIds[1034], $cleanupIds[1035], $cleanupIds[1036], $cleanupIds[1037], $cleanupIds[1038], $cleanupIds[1039], $cleanupIds[1040], $cleanupIds[1041], $cleanupIds[1042], $cleanupIds[1043], $cleanupIds[1044], $cleanupIds[1045], $cleanupIds[1046], $cleanupIds[1047], $cleanupIds[1048], $cleanupIds[1049], $cleanupIds[1050], $cleanupIds[1051], $cleanupIds[1052], $cleanupIds[1053], $cleanupIds[1054], $cleanupIds[1055], $cleanupIds[1056], $cleanupIds[1057], $cleanupIds[1058], $cleanupIds[1059], $cleanupIds[1060], $cleanupIds[1061], $cleanupIds[1062], $cleanupIds[1063], $cleanupIds[1064], $cleanupIds[1065], $cleanupIds[1066], $cleanupIds[1067], $cleanupIds[1068], $cleanupIds[1069], $cleanupIds[1070], $cleanupIds[1071], $cleanupIds[1072], $cleanupIds[1073], $cleanupIds[1074], $cleanupIds[1075], $cleanupIds[1076], $cleanupIds[1077], $cleanupIds[1078], $cleanupIds[1079], $cleanupIds[1080], $cleanupIds[1081], $cleanupIds[1082], $cleanupIds[1083], $cleanupIds[1084], $cleanupIds[1085], $cleanupIds[1086], $cleanupIds[1087], $cleanupIds[1088], $cleanupIds[1089], $cleanupIds[1090], $cleanupIds[1091], $cleanupIds[1092], $cleanupIds[1093], $cleanupIds[1094], $cleanupIds[1095], $cleanupIds[1096], $cleanupIds[1097], $cleanupIds[1098], $cleanupIds[1099], $cleanupIds[1100], $cleanupIds[1101], $cleanupIds[1102], $cleanupIds[1103], $cleanupIds[1104], $cleanupIds[1105], $cleanupIds[1106], $cleanupIds[1107], $cleanupIds[1108], $cleanupIds[1109], $cleanupIds[1110], $cleanupIds[1111], $cleanupIds[1112], $cleanupIds[1113], $cleanupIds[1114], $cleanupIds[1115], $cleanupIds[1116], $cleanupIds[1117], $cleanupIds[1118], $cleanupIds[1119], $cleanupIds[1120], $cleanupIds[1121], $cleanupIds[1122], $cleanupIds[1123], $cleanupIds[1124], $cleanupIds[1125], $cleanupIds[1126], $cleanupIds[1127], $cleanupIds[1128], $cleanupIds[1129], $cleanupIds[1130], $cleanupIds[1131], $cleanupIds[1132], $cleanupIds[1133], $cleanupIds[1134], $cleanupIds[1135], $cleanupIds[1136], $cleanupIds[1137], $cleanupIds[1138], $cleanupIds[1139], $cleanupIds[1140], $cleanupIds[1141], $cleanupIds[1142], $cleanupIds[1143], $cleanupIds[1144], $cleanupIds[1145], $cleanupIds[1146], $cleanupIds[1147], $cleanupIds[1148], $cleanupIds[1149], $cleanupIds[1150], $cleanupIds[1151], $cleanupIds[1152], $cleanupIds[1153], $cleanupIds[1154], $cleanupIds[1155], $cleanupIds[1156], $cleanupIds[1157], $cleanupIds[1158], $cleanupIds[1159], $cleanupIds[1160], $cleanupIds[1161], $cleanupIds[1162], $cleanupIds[1163], $cleanupIds[1164], $cleanupIds[1165], $cleanupIds[1166], $cleanupIds[1167], $cleanupIds[1168], $cleanupIds[1169], $cleanupIds[1170], $cleanupIds[1171], $cleanupIds[1172], $cleanupIds[1173], $cleanupIds[1174], $cleanupIds[1175], $cleanupIds[1176], $cleanupIds[1177], $cleanupIds[1178], $cleanupIds[1179], $cleanupIds[1180], $cleanupIds[1181], $cleanupIds[1182], $cleanupIds[1183], $cleanupIds[1184], $cleanupIds[1185], $cleanupIds[1186], $cleanupIds[1187], $cleanupIds[1188], $cleanupIds[1189], $cleanupIds[1190], $cleanupIds[1191], $cleanupIds[1192], $cleanupIds[1193], $cleanupIds[1194], $cleanupIds[1195], $cleanupIds[1196], $cleanupIds[1197], $cleanupIds[1198], $cleanupIds[1199], $cleanupIds[1200], $cleanupIds[1201], $cleanupIds[1202], $cleanupIds[1203], $cleanupIds[1204], $cleanupIds[1205], $cleanupIds[1206], $cleanupIds[1207], $cleanupIds[1208], $cleanupIds[1209], $cleanupIds[1210], $cleanupIds[1211], $cleanupIds[1212], $cleanupIds[1213], $cleanupIds[1214], $cleanupIds[1215], $cleanupIds[1216], $cleanupIds[1217], $cleanupIds[1218], $cleanupIds[1219], $cleanupIds[1220], $cleanupIds[1221], $cleanupIds[1222], $cleanupIds[1223], $cleanupIds[1224], $cleanupIds[1225], $cleanupIds[1226], $cleanupIds[1227], $cleanupIds[1228], $cleanupIds[1229], $cleanupIds[1230], $cleanupIds[1231], $cleanupIds[1232], $cleanupIds[1233], $cleanupIds[1234], $cleanupIds[1235], $cleanupIds[1236], $cleanupIds[1237], $cleanupIds[1238], $cleanupIds[1239], $cleanupIds[1240], $cleanupIds[1241], $cleanupIds[1242], $cleanupIds[1243], $cleanupIds[1244], $cleanupIds[1245], $cleanupIds[1246], $cleanupIds[1247], $cleanupIds[1248], $cleanupIds[1249], $cleanupIds[1250], $cleanupIds[1251], $cleanupIds[1252], $cleanupIds[1253], $cleanupIds[1254], $cleanupIds[1255], $cleanupIds[1256], $cleanupIds[1257], $cleanupIds[1258], $cleanupIds[1259], $cleanupIds[1260], $cleanupIds[1261], $cleanupIds[1262], $cleanupIds[1263], $cleanupIds[1264], $cleanupIds[1265], $cleanupIds[1266], $cleanupIds[1267], $cleanupIds[1268], $cleanupIds[1269], $cleanupIds[1270], $cleanupIds[1271], $cleanupIds[1272], $cleanupIds[1273], $cleanupIds[1274], $cleanupIds[1275], $cleanupIds[1276], $cleanupIds[1277], $cleanupIds[1278], $cleanupIds[1279], $cleanupIds[1280], $cleanupIds[1281], $cleanupIds[1282], $cleanupIds[1283], $cleanupIds[1284], $cleanupIds[1285], $cleanupIds[1286], $cleanupIds[1287], $cleanupIds[1288], $cleanupIds[1289], $cleanupIds[1290], $cleanupIds[1291], $cleanupIds[1292], $cleanupIds[1293], $cleanupIds[1294], $cleanupIds[1295], $cleanupIds[1296], $cleanupIds[1297], $cleanupIds[1298], $cleanupIds[1299], $cleanupIds[1300], $cleanupIds[1301], $cleanupIds[1302], $cleanupIds[1303], $cleanupIds[1304], $cleanupIds[1305], $cleanupIds[1306], $cleanupIds[1307], $cleanupIds[1308], $cleanupIds[1309], $cleanupIds[1310], $cleanupIds[1311], $cleanupIds[1312], $cleanupIds[1313], $cleanupIds[1314], $cleanupIds[1315], $cleanupIds[1316], $cleanupIds[1317], $cleanupIds[1318], $cleanupIds[1319], $cleanupIds[1320], $cleanupIds[1321], $cleanupIds[1322], $cleanupIds[1323], $cleanupIds[1324], $cleanupIds[1325], $cleanupIds[1326], $cleanupIds[1327], $cleanupIds[1328], $cleanupIds[1329], $cleanupIds[1330], $cleanupIds[1331], $cleanupIds[1332], $cleanupIds[1333], $cleanupIds[1334], $cleanupIds[1335], $cleanupIds[1336], $cleanupIds[1337], $cleanupIds[1338], $cleanupIds[1339], $cleanupIds[1340], $cleanupIds[1341], $cleanupIds[1342], $cleanupIds[1343], $cleanupIds[1344], $cleanupIds[1345], $cleanupIds[1346], $cleanupIds[1347], $cleanupIds[1348], $cleanupIds[1349], $cleanupIds[1350], $cleanupIds[1351], $cleanupIds[1352], $cleanupIds[1353], $cleanupIds[1354], $cleanupIds[1355], $cleanupIds[1356], $cleanupIds[1357], $cleanupIds[1358], $cleanupIds[1359], $cleanupIds[1360], $cleanupIds[1361], $cleanupIds[1362], $cleanupIds[1363], $cleanupIds[1364], $cleanupIds[1365], $cleanupIds[1366], $cleanupIds[1367], $cleanupIds[1368], $cleanupIds[1369], $cleanupIds[1370], $cleanupIds[1371], $cleanupIds[1372], $cleanupIds[1373], $cleanupIds[1374], $cleanupIds[1375], $cleanupIds[1376], $cleanupIds[1377], $cleanupIds[1378], $cleanupIds[1379], $cleanupIds[1380], $cleanupIds[1381], $cleanupIds[1382], $cleanupIds[1383], $cleanupIds[1384], $cleanupIds[1385], $cleanupIds[1386], $cleanupIds[1387], $cleanupIds[1388], $cleanupIds[1389], $cleanupIds[1390], $cleanupIds[1391], $cleanupIds[1392], $cleanupIds[1393], $cleanupIds[1394], $cleanupIds[1395], $cleanupIds[1396], $cleanupIds[1397], $cleanupIds[1398], $cleanupIds[1399], $cleanupIds[1400], $cleanupIds[1401], $cleanupIds[1402], $cleanupIds[1403], $cleanupIds[1404], $cleanupIds[1405], $cleanupIds[1406], $cleanupIds[1407], $cleanupIds[1408], $cleanupIds[1409], $cleanupIds[1410], $cleanupIds[1411], $cleanupIds[1412], $cleanupIds[1413], $cleanupIds[1414], $cleanupIds[1415], $cleanupIds[1416], $cleanupIds[1417], $cleanupIds[1418], $cleanupIds[1419], $cleanupIds[1420], $cleanupIds[1421], $cleanupIds[1422], $cleanupIds[1423], $cleanupIds[1424], $cleanupIds[1425], $cleanupIds[1426], $cleanupIds[1427], $cleanupIds[1428], $cleanupIds[1429], $cleanupIds[1430], $cleanupIds[1431], $cleanupIds[1432], $cleanupIds[1433], $cleanupIds[1434], $cleanupIds[1435], $cleanupIds[1436], $cleanupIds[1437], $cleanupIds[1438], $cleanupIds[1439], $cleanupIds[1440], $cleanupIds[1441], $cleanupIds[1442], $cleanupIds[1443], $cleanupIds[1444], $cleanupIds[1445], $cleanupIds[1446], $cleanupIds[1447], $cleanupIds[1448], $cleanupIds[1449], $cleanupIds[1450], $cleanupIds[1451], $cleanupIds[1452], $cleanupIds[1453], $cleanupIds[1454], $cleanupIds[1455], $cleanupIds[1456], $cleanupIds[1457], $cleanupIds[1458], $cleanupIds[1459], $cleanupIds[1460], $cleanupIds[1461], $cleanupIds[1462], $cleanupIds[1463], $cleanupIds[1464], $cleanupIds[1465], $cleanupIds[1466], $cleanupIds[1467], $cleanupIds[1468], $cleanupIds[1469], $cleanupIds[1470], $cleanupIds[1471], $cleanupIds[1472], $cleanupIds[1473], $cleanupIds[1474], $cleanupIds[1475], $cleanupIds[1476], $cleanupIds[1477], $cleanupIds[1478], $cleanupIds[1479], $cleanupIds[1480], $cleanupIds[1481], $cleanupIds[1482], $cleanupIds[1483], $cleanupIds[1484], $cleanupIds[1485], $cleanupIds[1486], $cleanupIds[1487], $cleanupIds[1488], $cleanupIds[1489], $cleanupIds[1490], $cleanupIds[1491], $cleanupIds[1492], $cleanupIds[1493], $cleanupIds[1494], $cleanupIds[1495], $cleanupIds[1496], $cleanupIds[1497], $cleanupIds[1498], $cleanupIds[1499], $cleanupIds[1500], $cleanupIds[1501], $cleanupIds[1502], $cleanupIds[1503], $cleanupIds[1504], $cleanupIds[1505], $cleanupIds[1506], $cleanupIds[1507], $cleanupIds[1508], $cleanupIds[1509], $cleanupIds[1510], $cleanupIds[1511], $cleanupIds[1512], $cleanupIds[1513], $cleanupIds[1514], $cleanupIds[1515], $cleanupIds[1516], $cleanupIds[1517], $cleanupIds[1518], $cleanupIds[1519], $cleanupIds[1520], $cleanupIds[1521], $cleanupIds[1522], $cleanupIds[1523], $cleanupIds[1524], $cleanupIds[1525], $cleanupIds[1526], $cleanupIds[1527], $cleanupIds[1528], $cleanupIds[1529], $cleanupIds[1530], $cleanupIds[1531], $cleanupIds[1532], $cleanupIds[1533], $cleanupIds[1534], $cleanupIds[1535], $cleanupIds[1536], $cleanupIds[1537], $cleanupIds[1538], $cleanupIds[1539], $cleanupIds[1540], $cleanupIds[1541], $cleanupIds[1542], $cleanupIds[1543], $cleanupIds[1544], $cleanupIds[1545], $cleanupIds[1546], $cleanupIds[1547], $cleanupIds[1548], $cleanupIds[1549], $cleanupIds[1550], $cleanupIds[1551], $cleanupIds[1552], $cleanupIds[1553], $cleanupIds[1554], $cleanupIds[1555], $cleanupIds[1556], $cleanupIds[1557], $cleanupIds[1558], $cleanupIds[1559], $cleanupIds[1560], $cleanupIds[1561], $cleanupIds[1562], $cleanupIds[1563], $cleanupIds[1564], $cleanupIds[1565], $cleanupIds[1566], $cleanupIds[1567], $cleanupIds[1568], $cleanupIds[1569], $cleanupIds[1570], $cleanupIds[1571], $cleanupIds[1572], $cleanupIds[1573], $cleanupIds[1574], $cleanupIds[1575], $cleanupIds[1576], $cleanupIds[1577], $cleanupIds[1578], $cleanupIds[1579], $cleanupIds[1580], $cleanupIds[1581], $cleanupIds[1582], $cleanupIds[1583], $cleanupIds[1584], $cleanupIds[1585], $cleanupIds[1586], $cleanupIds[1587], $cleanupIds[1588], $cleanupIds[1589], $cleanupIds[1590], $cleanupIds[1591], $cleanupIds[1592], $cleanupIds[1593], $cleanupIds[1594], $cleanupIds[1595], $cleanupIds[1596], $cleanupIds[1597], $cleanupIds[1598], $cleanupIds[1599], $cleanupIds[1600], $cleanupIds[1601], $cleanupIds[1602], $cleanupIds[1603], $cleanupIds[1604], $cleanupIds[1605], $cleanupIds[1606], $cleanupIds[1607], $cleanupIds[1608], $cleanupIds[1609], $cleanupIds[1610], $cleanupIds[1611], $cleanupIds[1612], $cleanupIds[1613], $cleanupIds[1614], $cleanupIds[1615], $cleanupIds[1616], $cleanupIds[1617], $cleanupIds[1618], $cleanupIds[1619], $cleanupIds[1620], $cleanupIds[1621], $cleanupIds[1622], $cleanupIds[1623], $cleanupIds[1624], $cleanupIds[1625], $cleanupIds[1626], $cleanupIds[1627], $cleanupIds[1628], $cleanupIds[1629], $cleanupIds[1630], $cleanupIds[1631], $cleanupIds[1632], $cleanupIds[1633], $cleanupIds[1634], $cleanupIds[1635], $cleanupIds[1636], $cleanupIds[1637], $cleanupIds[1638], $cleanupIds[1639], $cleanupIds[1640], $cleanupIds[1641], $cleanupIds[1642], $cleanupIds[1643], $cleanupIds[1644], $cleanupIds[1645], $cleanupIds[1646], $cleanupIds[1647], $cleanupIds[1648], $cleanupIds[1649], $cleanupIds[1650], $cleanupIds[1651], $cleanupIds[1652], $cleanupIds[1653], $cleanupIds[1654], $cleanupIds[1655], $cleanupIds[1656], $cleanupIds[1657], $cleanupIds[1658], $cleanupIds[1659], $cleanupIds[1660], $cleanupIds[1661], $cleanupIds[1662], $cleanupIds[1663], $cleanupIds[1664], $cleanupIds[1665], $cleanupIds[1666], $cleanupIds[1667], $cleanupIds[1668], $cleanupIds[1669], $cleanupIds[1670], $cleanupIds[1671], $cleanupIds[1672], $cleanupIds[1673], $cleanupIds[1674], $cleanupIds[1675], $cleanupIds[1676], $cleanupIds[1677], $cleanupIds[1678], $cleanupIds[1679], $cleanupIds[1680], $cleanupIds[1681], $cleanupIds[1682], $cleanupIds[1683], $cleanupIds[1684], $cleanupIds[1685], $cleanupIds[1686], $cleanupIds[1687], $cleanupIds[1688], $cleanupIds[1689], $cleanupIds[1690], $cleanupIds[1691], $cleanupIds[1692], $cleanupIds[1693], $cleanupIds[1694], $cleanupIds[1695], $cleanupIds[1696], $cleanupIds[1697], $cleanupIds[1698], $cleanupIds[1699], $cleanupIds[1700], $cleanupIds[1701], $cleanupIds[1702], $cleanupIds[1703], $cleanupIds[1704], $cleanupIds[1705], $cleanupIds[1706], $cleanupIds[1707], $cleanupIds[1708], $cleanupIds[1709], $cleanupIds[1710], $cleanupIds[1711], $cleanupIds[1712], $cleanupIds[1713], $cleanupIds[1714], $cleanupIds[1715], $cleanupIds[1716], $cleanupIds[1717], $cleanupIds[1718], $cleanupIds[1719], $cleanupIds[1720], $cleanupIds[1721], $cleanupIds[1722], $cleanupIds[1723], $cleanupIds[1724], $cleanupIds[1725], $cleanupIds[1726], $cleanupIds[1727], $cleanupIds[1728], $cleanupIds[1729], $cleanupIds[1730], $cleanupIds[1731], $cleanupIds[1732], $cleanupIds[1733], $cleanupIds[1734], $cleanupIds[1735], $cleanupIds[1736], $cleanupIds[1737], $cleanupIds[1738], $cleanupIds[1739], $cleanupIds[1740], $cleanupIds[1741], $cleanupIds[1742], $cleanupIds[1743], $cleanupIds[1744], $cleanupIds[1745], $cleanupIds[1746], $cleanupIds[1747], $cleanupIds[1748], $cleanupIds[1749], $cleanupIds[1750], $cleanupIds[1751], $cleanupIds[1752], $cleanupIds[1753], $cleanupIds[1754], $cleanupIds[1755], $cleanupIds[1756], $cleanupIds[1757], $cleanupIds[1758], $cleanupIds[1759], $cleanupIds[1760], $cleanupIds[1761], $cleanupIds[1762], $cleanupIds[1763], $cleanupIds[1764], $cleanupIds[1765], $cleanupIds[1766], $cleanupIds[1767], $cleanupIds[1768], $cleanupIds[1769], $cleanupIds[1770], $cleanupIds[1771], $cleanupIds[1772], $cleanupIds[1773], $cleanupIds[1774], $cleanupIds[1775], $cleanupIds[1776], $cleanupIds[1777], $cleanupIds[1778], $cleanupIds[1779], $cleanupIds[1780], $cleanupIds[1781], $cleanupIds[1782], $cleanupIds[1783], $cleanupIds[1784], $cleanupIds[1785], $cleanupIds[1786], $cleanupIds[1787], $cleanupIds[1788], $cleanupIds[1789], $cleanupIds[1790], $cleanupIds[1791], $cleanupIds[1792], $cleanupIds[1793], $cleanupIds[1794], $cleanupIds[1795], $cleanupIds[1796], $cleanupIds[1797], $cleanupIds[1798], $cleanupIds[1799], $cleanupIds[1800], $cleanupIds[1801], $cleanupIds[1802], $cleanupIds[1803], $cleanupIds[1804], $cleanupIds[1805], $cleanupIds[1806], $cleanupIds[1807], $cleanupIds[1808], $cleanupIds[1809], $cleanupIds[1810], $cleanupIds[1811], $cleanupIds[1812], $cleanupIds[1813], $cleanupIds[1814], $cleanupIds[1815], $cleanupIds[1816], $cleanupIds[1817], $cleanupIds[1818], $cleanupIds[1819], $cleanupIds[1820], $cleanupIds[1821], $cleanupIds[1822], $cleanupIds[1823], $cleanupIds[1824], $cleanupIds[1825], $cleanupIds[1826], $cleanupIds[1827], $cleanupIds[1828], $cleanupIds[1829], $cleanupIds[1830], $cleanupIds[1831], $cleanupIds[1832], $cleanupIds[1833], $cleanupIds[1834], $cleanupIds[1835], $cleanupIds[1836], $cleanupIds[1837], $cleanupIds[1838], $cleanupIds[1839], $cleanupIds[1840], $cleanupIds[1841], $cleanupIds[1842], $cleanupIds[1843], $cleanupIds[1844], $cleanupIds[1845], $cleanupIds[1846], $cleanupIds[1847], $cleanupIds[1848], $cleanupIds[1849], $cleanupIds[1850], $cleanupIds[1851], $cleanupIds[1852], $cleanupIds[1853], $cleanupIds[1854], $cleanupIds[1855], $cleanupIds[1856], $cleanupIds[1857], $cleanupIds[1858], $cleanupIds[1859], $cleanupIds[1860], $cleanupIds[1861], $cleanupIds[1862], $cleanupIds[1863], $cleanupIds[1864], $cleanupIds[1865], $cleanupIds[1866], $cleanupIds[1867], $cleanupIds[1868], $cleanupIds[1869], $cleanupIds[1870], $cleanupIds[1871], $cleanupIds[1872], $cleanupIds[1873], $cleanupIds[1874], $cleanupIds[1875], $cleanupIds[1876], $cleanupIds[1877], $cleanupIds[1878], $cleanupIds[1879], $cleanupIds[1880], $cleanupIds[1881], $cleanupIds[1882], $cleanupIds[1883], $cleanupIds[1884], $cleanupIds[1885], $cleanupIds[1886], $cleanupIds[1887], $cleanupIds[1888], $cleanupIds[1889], $cleanupIds[1890], $cleanupIds[1891], $cleanupIds[1892], $cleanupIds[1893], $cleanupIds[1894], $cleanupIds[1895], $cleanupIds[1896], $cleanupIds[1897], $cleanupIds[1898], $cleanupIds[1899], $cleanupIds[1900], $cleanupIds[1901], $cleanupIds[1902], $cleanupIds[1903], $cleanupIds[1904], $cleanupIds[1905], $cleanupIds[1906], $cleanupIds[1907], $cleanupIds[1908], $cleanupIds[1909], $cleanupIds[1910], $cleanupIds[1911], $cleanupIds[1912], $cleanupIds[1913], $cleanupIds[1914], $cleanupIds[1915], $cleanupIds[1916], $cleanupIds[1917], $cleanupIds[1918], $cleanupIds[1919], $cleanupIds[1920], $cleanupIds[1921], $cleanupIds[1922], $cleanupIds[1923], $cleanupIds[1924], $cleanupIds[1925], $cleanupIds[1926], $cleanupIds[1927], $cleanupIds[1928], $cleanupIds[1929], $cleanupIds[1930], $cleanupIds[1931], $cleanupIds[1932], $cleanupIds[1933], $cleanupIds[1934], $cleanupIds[1935], $cleanupIds[1936], $cleanupIds[1937], $cleanupIds[1938], $cleanupIds[1939], $cleanupIds[1940], $cleanupIds[1941], $cleanupIds[1942], $cleanupIds[1943], $cleanupIds[1944], $cleanupIds[1945], $cleanupIds[1946], $cleanupIds[1947], $cleanupIds[1948], $cleanupIds[1949], $cleanupIds[1950], $cleanupIds[1951], $cleanupIds[1952], $cleanupIds[1953], $cleanupIds[1954], $cleanupIds[1955], $cleanupIds[1956], $cleanupIds[1957], $cleanupIds[1958], $cleanupIds[1959], $cleanupIds[1960], $cleanupIds[1961], $cleanupIds[1962], $cleanupIds[1963], $cleanupIds[1964], $cleanupIds[1965], $cleanupIds[1966], $cleanupIds[1967], $cleanupIds[1968], $cleanupIds[1969], $cleanupIds[1970], $cleanupIds[1971], $cleanupIds[1972], $cleanupIds[1973], $cleanupIds[1974], $cleanupIds[1975], $cleanupIds[1976], $cleanupIds[1977], $cleanupIds[1978], $cleanupIds[1979], $cleanupIds[1980], $cleanupIds[1981], $cleanupIds[1982], $cleanupIds[1983], $cleanupIds[1984], $cleanupIds[1985], $cleanupIds[1986], $cleanupIds[1987], $cleanupIds[1988], $cleanupIds[1989], $cleanupIds[1990], $cleanupIds[1991], $cleanupIds[1992], $cleanupIds[1993], $cleanupIds[1994], $cleanupIds[1995], $cleanupIds[1996], $cleanupIds[1997], $cleanupIds[1998], $cleanupIds[1999], $cleanupIds[2000], $cleanupIds[2001], $cleanupIds[2002], $cleanupIds[2003], $cleanupIds[2004], $cleanupIds[2005], $cleanupIds[2006]); + + /* execute query */ + $stmt->execute(); + + /* close statement */ + $stmt->close(); + } + + mysqli_close($link); + print "done!"; +?> +--CLEAN-- +<?php + require_once("clean_table.inc"); +?> +--EXPECTF-- +done! diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 1d4e387d2..1a898690e 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -1180,7 +1180,7 @@ static enum_func_status MYSQLND_METHOD(mysqlnd_conn_data, send_query)(MYSQLND_CONN_DATA * conn, const char * query, unsigned int query_len TSRMLS_DC) { size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, send_query); - enum_func_status ret; + enum_func_status ret = FAIL; DBG_ENTER("mysqlnd_conn_data::send_query"); DBG_INF_FMT("conn=%llu query=%s", conn->thread_id, query); @@ -1587,7 +1587,7 @@ static ulong MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, escape_string); - ulong ret; + ulong ret = FAIL; DBG_ENTER("mysqlnd_conn_data::escape_string"); DBG_INF_FMT("conn=%llu", conn->thread_id); diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index 9961d68e4..d8ad06c60 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -559,6 +559,7 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar *p += null_count; } + left = (*buf_len - (*p - *buf)); /* 1. Store type information */ /* check if need to send the types even if stmt->send_types_to_server is 0. This is because diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml index c51d216f3..feadf1907 100644 --- a/ext/oci8/package.xml +++ b/ext/oci8/package.xml @@ -6,7 +6,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> <name>oci8</name> <channel>pecl.php.net</channel> <summary>Extension for Oracle Database</summary> - <description>This extension allows you to access Oracle databases. It can be built with PHP 4.3.9 to 5.x. It can be linked with Oracle 9.2, 10.2, 11.1, or 11.2 client libraries. + <description>This extension allows you to access Oracle databases. It can be built with PHP 4.3.9 to 5.x. It can be linked with Oracle 9.2, 10, 11, or 12.1 client libraries. </description> <lead> <name>Christopher Jones</name> @@ -33,12 +33,12 @@ http://pear.php.net/dtd/package-2.0.xsd"> <active>no</active> </lead> - <date>2012-10-21</date> + <date>2013-07-08</date> <time>12:00:00</time> <version> - <release>1.4.9</release> - <api>1.4.9</api> + <release>1.4.10</release> + <api>1.4.10</api> </version> <stability> <release>stable</release> @@ -46,7 +46,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> </stability> <license uri="http://www.php.net/license">PHP</license> <notes> - Re-fixed bug #60901 (Improve "tail" syntax for AIX installation) + Bump PECL package info version check to allow PECL installs with PHP 5.5+ </notes> <contents> <dir name="/"> @@ -397,7 +397,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> <required> <php> <min>4.3.9</min> - <max>5.4.99</max> + <max>6.0.0</max> </php> <pearinstaller> <min>1.4.0b1</min> @@ -412,6 +412,21 @@ http://pear.php.net/dtd/package-2.0.xsd"> <release> <version> + <release>1.4.9</release> + <api>1.4.9</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://www.php.net/license">PHP</license> + <notes> + Re-fixed bug #60901 (Improve "tail" syntax for AIX installation) + </notes> +</release> + +<release> + <version> <release>1.4.8</release> <api>1.4.8</api> </version> diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h index 6632bc88f..f1079526f 100644 --- a/ext/oci8/php_oci8.h +++ b/ext/oci8/php_oci8.h @@ -46,7 +46,7 @@ */ #undef PHP_OCI8_VERSION #endif -#define PHP_OCI8_VERSION "1.4.9" +#define PHP_OCI8_VERSION "1.4.10" extern zend_module_entry oci8_module_entry; #define phpext_oci8_ptr &oci8_module_entry diff --git a/ext/oci8/tests/bug43492_2.phpt b/ext/oci8/tests/bug43492_2.phpt index 61511cf6d..d735f6429 100644 --- a/ext/oci8/tests/bug43492_2.phpt +++ b/ext/oci8/tests/bug43492_2.phpt @@ -8,7 +8,7 @@ require(dirname(__FILE__).'/skipif.inc'); --FILE-- <?php -// This test is similar to bug43492.phpt without the explict free. +// This test is similar to bug43492.phpt without the explicit free. // Now that bug 44206 is fixed an automatic clean up will occur - // though it is still recommended in practice. diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index adb7272d4..c84a4ecc6 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -1765,7 +1765,7 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) if (result_type & ODBC_NUM) { zend_hash_index_update(Z_ARRVAL_P(return_value), i, &tmp, sizeof(zval *), NULL); } else { - if (!*(result->values[i].name)) { + if (!*(result->values[i].name) && Z_TYPE_P(tmp) == IS_STRING) { zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)+1, &tmp, sizeof(zval *), NULL); } else { zend_hash_update(Z_ARRVAL_P(return_value), result->values[i].name, strlen(result->values[i].name)+1, &tmp, sizeof(zval *), NULL); @@ -2704,7 +2704,7 @@ PHP_FUNCTION(odbc_num_rows) #if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) /* {{{ proto bool odbc_next_result(resource result_id) - Checks if multiple results are avaiable */ + Checks if multiple results are available */ PHP_FUNCTION(odbc_next_result) { odbc_result *result; diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 875a4727a..f05798e04 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -138,7 +138,7 @@ static inline int is_stream_path(const char *filename) return ((*p == ':') && (p - filename > 1) && (p[1] == '/') && (p[2] == '/')); } -static inline int is_cachable_stream_path(const char *filename) +static inline int is_cacheable_stream_path(const char *filename) { return memcmp(filename, "file://", sizeof("file://") - 1) == 0 || memcmp(filename, "phar://", sizeof("phar://") - 1) == 0; @@ -1455,7 +1455,7 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int CG(interactive) || (ZCSG(restart_in_progress) && accel_restart_is_active(TSRMLS_C)) || (is_stream_path(file_handle->filename) && - !is_cachable_stream_path(file_handle->filename))) { + !is_cacheable_stream_path(file_handle->filename))) { /* The Accelerator is disabled, act as if without the Accelerator */ return accelerator_orig_compile_file(file_handle, type TSRMLS_CC); } @@ -2163,7 +2163,10 @@ static void accel_fast_zval_ptr_dtor(zval **zval_ptr) case IS_CONSTANT_ARRAY: { TSRMLS_FETCH(); + GC_REMOVE_ZVAL_FROM_BUFFER(zvalue); if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) { + /* break possible cycles */ + Z_TYPE_P(zvalue) = IS_NULL; zvalue->value.ht->pDestructor = (dtor_func_t)accel_fast_zval_ptr_dtor; accel_fast_hash_destroy(zvalue->value.ht); } @@ -2173,6 +2176,7 @@ static void accel_fast_zval_ptr_dtor(zval **zval_ptr) { TSRMLS_FETCH(); + GC_REMOVE_ZVAL_FROM_BUFFER(zvalue); Z_OBJ_HT_P(zvalue)->del_ref(zvalue TSRMLS_CC); } break; @@ -2375,6 +2379,7 @@ static inline int accel_find_sapi(TSRMLS_D) "isapi", "apache2filter", "apache2handler", + "litespeed", NULL }; const char **sapi_name; @@ -2499,7 +2504,7 @@ static int accel_startup(zend_extension *extension) strcmp(sapi_module.name, "cli") == 0) { zps_startup_failure("Opcode Caching is disabled for CLI", NULL, accelerator_remove_cb TSRMLS_CC); } else { - zps_startup_failure("Opcode Caching is only supported in Apache, ISAPI, FPM and FastCGI SAPIs", NULL, accelerator_remove_cb TSRMLS_CC); + zps_startup_failure("Opcode Caching is only supported in Apache, ISAPI, FPM, FastCGI and LiteSpeed SAPIs", NULL, accelerator_remove_cb TSRMLS_CC); } return SUCCESS; } diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index c24d9f130..39b4c1fc2 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -936,7 +936,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, zend_hash_destroy(&ZCG(bind_hash)); } /* we must first to copy all classes and then prepare functions, since functions may try to bind - classes - which depend on pre-bind class entries existant in the class table */ + classes - which depend on pre-bind class entries existent in the class table */ if (zend_hash_num_elements(&persistent_script->function_table) > 0) { zend_accel_function_hash_copy(CG(function_table), &persistent_script->function_table, (unique_copy_ctor_func_t)zend_prepare_function_for_execution); } diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c index abdee8322..574276b7c 100644 --- a/ext/pcntl/php_signal.c +++ b/ext/pcntl/php_signal.c @@ -23,7 +23,7 @@ #include "Zend/zend.h" #include "Zend/zend_signal.h" -/* php_signal using sigaction is derrived from Advanced Programing +/* php_signal using sigaction is derived from Advanced Programing * in the Unix Environment by W. Richard Stevens p 298. */ Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all) { diff --git a/ext/pcre/tests/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt index 29dfc5af1..ae2eb128b 100644 --- a/ext/pcre/tests/preg_grep_error1.phpt +++ b/ext/pcre/tests/preg_grep_error1.phpt @@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE); * Testing how preg_grep reacts to being passed bad regexes */ echo "*** Testing preg_grep() : error conditions ***\n"; -$values = array('abcdef', //Regex without delimeter -'/[a-zA-Z]', //Regex without closing delimeter -'[a-zA-Z]/', //Regex without opening delimeter +$values = array('abcdef', //Regex without delimiter +'/[a-zA-Z]', //Regex without closing delimiter +'[a-zA-Z]/', //Regex without opening delimiter '/[a-zA-Z]/F', array('[a-z]', //Array of Regexes '[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string ); diff --git a/ext/pcre/tests/preg_match_all_error1.phpt b/ext/pcre/tests/preg_match_all_error1.phpt index a3cb68404..95ab905d7 100644 --- a/ext/pcre/tests/preg_match_all_error1.phpt +++ b/ext/pcre/tests/preg_match_all_error1.phpt @@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE); * Testing how preg_match_all reacts to being passed the wrong type of regex argument */ echo "*** Testing preg_match_all() : error conditions ***\n"; -$regex_array = array('abcdef', //Regex without delimeter -'/[a-zA-Z]', //Regex without closing delimeter -'[a-zA-Z]/', //Regex without opening delimeter +$regex_array = array('abcdef', //Regex without delimiter +'/[a-zA-Z]', //Regex without closing delimiter +'[a-zA-Z]/', //Regex without opening delimiter '/[a-zA-Z]/F', array('[a-z]', //Array of Regexes '[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string ); diff --git a/ext/pcre/tests/preg_match_error1.phpt b/ext/pcre/tests/preg_match_error1.phpt index 763048151..ec9cf8cec 100644 --- a/ext/pcre/tests/preg_match_error1.phpt +++ b/ext/pcre/tests/preg_match_error1.phpt @@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE); * Testing how preg_match reacts to being passed the wrong type of regex argument */ echo "*** Testing preg_match() : error conditions ***\n"; -$regex_array = array('abcdef', //Regex without delimeter -'/[a-zA-Z]', //Regex without closing delimeter -'[a-zA-Z]/', //Regex without opening delimeter +$regex_array = array('abcdef', //Regex without delimiter +'/[a-zA-Z]', //Regex without closing delimiter +'[a-zA-Z]/', //Regex without opening delimiter '/[a-zA-Z]/F', array('[a-z]', //Array of Regexes '[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string ); diff --git a/ext/pcre/tests/preg_replace_error1.phpt b/ext/pcre/tests/preg_replace_error1.phpt index 7ddfcfdef..ec573c77b 100644 --- a/ext/pcre/tests/preg_replace_error1.phpt +++ b/ext/pcre/tests/preg_replace_error1.phpt @@ -11,9 +11,9 @@ error_reporting(E_ALL&~E_NOTICE); * Testing how preg_replace reacts to being passed the wrong type of regex argument */ echo "*** Testing preg_replace() : error conditions***\n"; -$regex_array = array('abcdef', //Regex without delimeter -'/[a-zA-Z]', //Regex without closing delimeter -'[a-zA-Z]/', //Regex without opening delimeter +$regex_array = array('abcdef', //Regex without delimiter +'/[a-zA-Z]', //Regex without closing delimiter +'[a-zA-Z]/', //Regex without opening delimiter '/[a-zA-Z]/F', array('[a-z]', //Array of Regexes '[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string ); diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 25db6842f..ee763571c 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -899,7 +899,7 @@ static PHP_METHOD(PDO, getAttribute) PDO_DBH_CLEAR_ERR(); PDO_CONSTRUCT_CHECK; - /* handle generic PDO-level atributes */ + /* handle generic PDO-level attributes */ switch (attr) { case PDO_ATTR_PERSISTENT: RETURN_BOOL(dbh->is_persistent); diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index 9ed508736..ff4251472 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -274,9 +274,13 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ ,{"5.0",DBVERSION_70} /* FIXME: This does not work with Sybase, but environ will */ ,{"6.0",DBVERSION_70} ,{"7.0",DBVERSION_70} +#ifdef DBVERSION_71 ,{"7.1",DBVERSION_71} +#endif +#ifdef DBVERSION_72 ,{"7.2",DBVERSION_72} ,{"8.0",DBVERSION_72} +#endif ,{"10.0",DBVERSION_100} ,{"auto",0} /* Only works with FreeTDS. Other drivers will bork */ @@ -346,6 +350,12 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ DBSETLAPP(H->login, vars[1].optval); +#ifdef DBSETLDBNAME + if (vars[3].optval) { + DBSETLDBNAME(H->login, vars[3].optval); + } +#endif + H->link = dbopen(H->login, vars[2].optval); if (!H->link) { @@ -361,10 +371,6 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ /* allow double quoted indentifiers */ DBSETOPT(H->link, DBQUOTEDIDENT, "1"); - if (vars[3].optval) { - DBSETLDBNAME(H->login, vars[3].optval); - } - ret = 1; dbh->max_escaped_char_length = 2; dbh->alloc_own_columns = 1; diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c index ed51e947c..401d20d8b 100644 --- a/ext/pdo_mysql/pdo_mysql.c +++ b/ext/pdo_mysql/pdo_mysql.c @@ -61,7 +61,7 @@ ZEND_DECLARE_MODULE_GLOBALS(pdo_mysql) #include "ext/mysqlnd/mysqlnd_reverse_api.h" static MYSQLND * pdo_mysql_convert_zv_to_mysqlnd(zval * zv TSRMLS_DC) { - if (Z_TYPE_P(zv) == IS_OBJECT && Z_OBJCE_P(zv) == php_pdo_get_dbh_ce()) { + if (Z_TYPE_P(zv) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), php_pdo_get_dbh_ce() TSRMLS_CC)) { pdo_dbh_t * dbh = zend_object_store_get_object(zv TSRMLS_CC); if (!dbh || dbh->driver != &pdo_mysql_driver) { diff --git a/ext/pdo_mysql/tests/mysql_pdo_test.inc b/ext/pdo_mysql/tests/mysql_pdo_test.inc index 115aeadc5..7a97bb463 100644 --- a/ext/pdo_mysql/tests/mysql_pdo_test.inc +++ b/ext/pdo_mysql/tests/mysql_pdo_test.inc @@ -162,8 +162,8 @@ class MySQLPDOTest extends PDOTest { phpinfo(); $tmp = ob_get_contents(); ob_end_clean(); - $tmp = stristr($tmp, "PDO Driver for MySQL => enabled"); - return (bool)preg_match('/Client API version.*mysqlnd/', $tmp); + return (preg_match('/PDO Driver for MySQL.*enabled/', $tmp) && + preg_match('/Client API version.*mysqlnd/', $tmp)); } static function dropTestTable($db = NULL) { @@ -174,4 +174,4 @@ class MySQLPDOTest extends PDOTest { } } -?>
\ No newline at end of file +?> diff --git a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt index a570c1fd4..9674e85f5 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt @@ -18,10 +18,9 @@ $db = MySQLPDOTest::factory(); ob_end_clean(); /* PDO Driver for MySQL, client library version => 6.0.3-alpha */ - $expected = sprintf('Client API version => %s', - $db->getAttribute(PDO::ATTR_CLIENT_VERSION)); + $reg = 'Client API version.*' . pcre_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/'); - if (false === stristr($tmp, $expected)) { + if (!preg_match("/$reg/", $tmp)) { printf("[001] Cannot find MySQL PDO driver line in phpinfo() output\n"); } diff --git a/ext/pdo_oci/config.m4 b/ext/pdo_oci/config.m4 index 309bde8a5..0e42d1f9a 100755 --- a/ext/pdo_oci/config.m4 +++ b/ext/pdo_oci/config.m4 @@ -2,7 +2,7 @@ dnl $Id$ dnl config.m4 for extension pdo_oci dnl vim:et:sw=2:ts=2: -SUPPORTED_LIB_VERS="9.0 10.1 11.1" # This caters for all Oracle 9.x, 10.x and 11.1 installs +SUPPORTED_LIB_VERS="9.0 10.1 11.1 12.1" # The lib vers are not bumped when the DB version is bumped AC_DEFUN([AC_PDO_OCI_VERSION],[ AC_MSG_CHECKING([Oracle version]) for OCI_VER in $SUPPORTED_LIB_VERS; do @@ -147,7 +147,7 @@ You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_ fi case $PDO_OCI_VERSION in - 9.0|10.1|10.2|11.1|11.2) + 9.0|10.1|10.2|11.1|11.2|12.1) PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD) ;; diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt index 81e9b74ff..ab9b99fc6 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt @@ -1,5 +1,5 @@ --TEST-- -PDO_OCI: Atrribute: closing a connection in non-autocommit mode commits data +PDO_OCI: Attribute: closing a connection in non-autocommit mode commits data --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded'); diff --git a/ext/pdo_oci/tests/pdo_oci_attr_client.phpt b/ext/pdo_oci/tests/pdo_oci_attr_client.phpt index 372ccec8e..eadb028e0 100644 --- a/ext/pdo_oci/tests/pdo_oci_attr_client.phpt +++ b/ext/pdo_oci/tests/pdo_oci_attr_client.phpt @@ -18,7 +18,7 @@ $cv = $dbh->getAttribute(PDO::ATTR_CLIENT_VERSION); var_dump($cv); $s = explode(".", $cv); -if ($s[0] >= 10 && count($s) > 1 && $s[1] >= 2) { +if (count($s) > 1 && (($s[0] == 10 && $s[1] >= 2) || $s[0] >= 11)) { if (count($s) != 5) { echo "Wrong number of values in array\nVersion was: "; var_dump($cv); diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index d58eebf8f..3ef89196d 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -587,7 +587,7 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *return add_assoc_long(return_value, "pgsql:oid", S->cols[colno].pgsql_type); /* Fetch metadata from Postgres system catalogue */ - spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%d", S->cols[colno].pgsql_type); + spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%u", S->cols[colno].pgsql_type); res = PQexec(S->H->server, q); efree(q); diff --git a/ext/pgsql/mysql_users.php b/ext/pgsql/mysql_users.php index 65a2c3396..edfaa1cdd 100644 --- a/ext/pgsql/mysql_users.php +++ b/ext/pgsql/mysql_users.php @@ -56,7 +56,7 @@ ORDER BY 1; /* * mysql_list_fields() * - * See also pg_meta_data(). It returns field defintion as array. + * See also pg_meta_data(). It returns field definition as array. */ function pg_list_fields($db, $table) { diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index dcc2c2869..128c2894f 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -4212,6 +4212,7 @@ PHP_FUNCTION(pg_unescape_bytea) to = (char *)php_pgsql_unescape_bytea((unsigned char*)from, &to_len); #endif if (!to) { + php_error_docref(NULL TSRMLS_CC, E_WARNING,"Invalid parameter"); RETURN_FALSE; } RETVAL_STRINGL(to, to_len, 0); @@ -4573,6 +4574,7 @@ PHP_FUNCTION(pg_send_query) PGconn *pgsql; PGresult *res; int leftover = 0; + int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &query, &len) == FAILURE) { @@ -4600,6 +4602,14 @@ PHP_FUNCTION(pg_send_query) RETURN_FALSE; } } + /* Wait to finish sending buffer */ + while ((ret = PQflush(pgsql))) { + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer"); + break; + } + usleep(10000); + } if (PQ_SETNONBLOCKING(pgsql, 0)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); } @@ -4620,6 +4630,7 @@ PHP_FUNCTION(pg_send_query_params) PGconn *pgsql; PGresult *res; int leftover = 0; + int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa/", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) { return; @@ -4686,6 +4697,14 @@ PHP_FUNCTION(pg_send_query_params) } } _php_pgsql_free_params(params, num_params); + /* Wait to finish sending buffer */ + while ((ret = PQflush(pgsql))) { + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer"); + break; + } + usleep(10000); + } if (PQ_SETNONBLOCKING(pgsql, 0)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); } @@ -4705,6 +4724,7 @@ PHP_FUNCTION(pg_send_prepare) PGconn *pgsql; PGresult *res; int leftover = 0; + int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) { return; @@ -4735,6 +4755,14 @@ PHP_FUNCTION(pg_send_prepare) RETURN_FALSE; } } + /* Wait to finish sending buffer */ + while ((ret = PQflush(pgsql))) { + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty postgres send buffer"); + break; + } + usleep(10000); + } if (PQ_SETNONBLOCKING(pgsql, 0)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); } @@ -4757,6 +4785,7 @@ PHP_FUNCTION(pg_send_execute) PGconn *pgsql; PGresult *res; int leftover = 0; + int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) { return; @@ -4823,6 +4852,14 @@ PHP_FUNCTION(pg_send_execute) } } _php_pgsql_free_params(params, num_params); + /* Wait to finish sending buffer */ + while ((ret = PQflush(pgsql))) { + if (ret == -1) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty postgres send buffer"); + break; + } + usleep(10000); + } if (PQ_SETNONBLOCKING(pgsql, 0)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode"); } diff --git a/ext/phar/Makefile.frag b/ext/phar/Makefile.frag index e2b016d84..faa9db0c7 100644 --- a/ext/phar/Makefile.frag +++ b/ext/phar/Makefile.frag @@ -40,3 +40,7 @@ install-pharcmd: pharcmd $(INSTALL) $(builddir)/phar.phar $(INSTALL_ROOT)$(bindir) -@rm -f $(INSTALL_ROOT)$(bindir)/phar $(LN_S) -f $(bindir)/phar.phar $(INSTALL_ROOT)$(bindir)/phar + @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1 + @$(INSTALL_DATA) $(builddir)/phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.1 + @$(INSTALL_DATA) $(builddir)/phar.phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.phar.1 + diff --git a/ext/phar/config.m4 b/ext/phar/config.m4 index 2ac7f3dd8..d424060f2 100644 --- a/ext/phar/config.m4 +++ b/ext/phar/config.m4 @@ -27,4 +27,6 @@ if test "$PHP_PHAR" != "no"; then PHP_ADD_EXTENSION_DEP(phar, hash, true) PHP_ADD_EXTENSION_DEP(phar, spl, true) PHP_ADD_MAKEFILE_FRAGMENT + + PHP_OUTPUT(ext/phar/phar.1 ext/phar/phar.phar.1) fi diff --git a/ext/phar/phar.1.in b/ext/phar/phar.1.in new file mode 100644 index 000000000..259a2bae8 --- /dev/null +++ b/ext/phar/phar.1.in @@ -0,0 +1,523 @@ +.TH PHAR 1 "2013" "The PHP Group" "User Commands" +.SH NAME +phar, phar.phar \- PHAR (PHP archive) command line tool +.SH SYNOPSIS +.B phar +<command> [options] ... +.LP +.SH DESCRIPTION +The \fBPHAR\fP file format provides a way to put entire PHP applications into a single +file called a "phar" (PHP Archive) for easy distribution and installation. +.P +With the \fBphar\fP command you can create, update or extract PHP archives. +.P +Commands: +add compress delete extract help help-list info list meta-del +meta-get meta-set pack sign stub-get stub-set tree version + +.SH add command +Add entries to a PHAR package. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.TP +.PD +.B ... +Any number of input files and directories. If -i is in +use then ONLY files and matching the given regular +expression are being packed. If -x is given then files +matching that regular expression are NOT being packed. +.P +Optional arguments: +.TP 15 +.PD +.B \-a \fIalias\fP +Provide an \fIalias\fP name for the phar file. +.TP +.PD +.B \-c \fIalgo\fP +Compression algorithm (see +.SM +.B COMPRESSION +) +.TP +.PD +.B \-i \fIregex\fP +Specifies a regular expression for input files. +.TP +.PD +.B \-l \fIlevel\fP +Number of preceding subdirectories to strip from file entries +.TP +.PD +.B \-x \fIregex\fP +Regular expression for input files to exclude. + +.SH compress command +Compress or uncompress all files or a selected entry. +.P +Required arguments: +.TP 15 +.PD +.B \-c \fIalgo\fP +Compression algorithm (see +.SM +.B COMPRESSION +) +.TP +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.P +Optional arguments: +.TP 15 +.PD +.B -e \fIentry\fP +Name of \fIentry\fP to work on (must include PHAR internal +directory name if any). + +.SH delete command +Delete entry from a PHAR archive +.P +Required arguments: +.TP 15 +.PD +.B \-e \fIentry\fP +Name of \fIentry\fP to work on (must include PHAR internal +directory name if any). +.TP +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. + +.SH extract command +Extract a PHAR package to a directory. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.P +Optional arguments: +.TP 15 +.PD +.B -i \fIregex\fP +Specifies a regular expression for input files. +.TP +.PD +.B -x \fIregex\fP +Regular expression for input files to exclude. +.TP +.PD +.B ... +Directory to extract to (defaults to '.'). + + +.SH help command +This help or help for a selected command. +.P +Optional arguments: +.TP 15 +.PD +.B ... +Optional command to retrieve help for. + +.SH help-list command +Lists available commands. + +.SH info command +Get information about a PHAR package. +.P +By using -k it is possible to return a single value. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.P +Optional arguments: +.TP 15 +.PD +.B -k \fIindex\fP +Subscription \fIindex\fP to work on. + +.SH list command +List contents of a PHAR archive. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.P +Optional arguments: +.TP 15 +.PD +.B -i \fIregex\fP +Specifies a regular expression for input files. +.TP +.PD +.B -x \fIregex\fP +Regular expression for input files to exclude. + + +.SH meta-del command +Delete meta information of a PHAR entry or a PHAR package. +.P +If -k is given then the metadata is expected to be an array and the +given index is being deleted. +.P +If something was deleted the return value is 0 otherwise it is 1. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.P +Optional arguments: +.TP 15 +.PD +.B -e \fIentry\fP +Name of \fIentry\fP to work on (must include PHAR internal +directory name if any). +.TP +.PD +.B -k \fIindex\fP +Subscription \fIindex\fP to work on. + +.SH meta-get command +Get meta information of a PHAR entry or a PHAR package in serialized from. If +no output file is specified for meta data then stdout is being used. +You can also specify a particular index using -k. In that case the +metadata is expected to be an array and the value of the given index +is returned using echo rather than using serialize. If that index does +not exist or no meta data is present then the return value is 1. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.P +Optional arguments: +.TP 15 +.PD +.B -e \fIentry\fP +Name of \fIentry\fP to work on (must include PHAR internal +directory name if any). +.TP +.PD +.B -k \fIindex\fP +Subscription \fIindex\fP to work on. + +.SH meta-set command +Set meta data of a PHAR entry or a PHAR package using serialized input. If no +input file is specified for meta data then stdin is being used. You can +also specify a particular index using -k. In that case the metadata is +expected to be an array and the value of the given index is being set. +If the metadata is not present or empty a new array will be created. +If the metadata is present and a flat value then the return value is +1. Also using -k the input is been taken directly rather then being +serialized. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.TP +.PD +.B -m \fImeta\fP +Meta data to store with entry (serialized php data). +.P +Optional arguments: +.TP 15 +.PD +.B -e \fIentry\fP +Name of \fIentry\fP to work on (must include PHAR internal +directory name if any). +.TP +.PD +.B -k \fIindex\fP +Subscription \fIindex\fP to work on. + +.SH pack command +Pack files into a PHAR archive. +.P +When using -s <stub>, then the stub file is being excluded from the +list of input files/dirs.To create an archive that contains PEAR class +PHP_Archive then point -p argument to PHP/Archive.php. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.TP +.PD +.B ... +Any number of input files and directories. If -i is in +use then ONLY files and matching the given regular +expression are being packed. If -x is given then files +matching that regular expression are NOT being packed. +.P +Optional arguments: +.TP 15 +.PD +.B \-a \fIalias\fP +Provide an \fIalias\fP name for the phar file. +.TP +.PD +.B \-b \fIbang\fP +Hash-bang line to start the archive (e.g. #!/usr/bin/php). +The hash mark itself '#!' and the newline character are optional. +.TP +.PD +.B \-c \fIalgo\fP +Compression algorithm (see +.SM +.B COMPRESSION +) +.TP +.PD +.B \-h \fIhash\fP +Selects the \fIhash\fP algorithm (see +.SM +.B HASH +) +.TP +.PD +.B \-i \fIregex\fP +Specifies a regular expression for input files. +.TP +.PD +.B \-l \fIlevel\fP +Number of preceding subdirectories to strip from file entries +.TP +.PD +.B \-p \fIloader\fP +Location of PHP_Archive class file (pear list-files +PHP_Archive).You can use '0' or '1' to locate it +automatically using the mentioned pear command. When +using '0' the command does not error out when the class +file cannot be located. This switch also adds some code +around the stub so that class PHP_Archive gets +registered as phar:// stream wrapper if necessary. And +finally this switch will add the file phar.inc from +this package and load it to ensure class Phar is +present. +.TP +.PD +.B \-s \fIstub\fP +Select the \fIstub\fP file. +.TP +.PD +.B \-x \fIregex\fP +Regular expression for input files to exclude. +.TP +.PD +.B \-y \fIkey\fP +Private \fIkey\fP for OpenSSL signing. + +.SH sign command +Set signature hash algorithm. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.TP +.PD +.B \-h \fIhash\fP +Selects the \fIhash\fP algorithm (see +.SM +.B HASH +) +.P +Optional arguments: +.TP 15 +.PD +.B \-y \fIkey\fP +Private \fIkey\fP for OpenSSL signing. + +.SH stub-get command +Get the stub of a PHAR file. If no output file is specified as stub then stdout +is being used. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.P +Optional arguments: +.TP 15 +.PD +.B \-s \fIstub\fP +Select the \fIstub\fP file. + +.SH stub-set command +Set the stub of a PHAR file. If no input file is specified as stub then stdin +is being used. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.P +Optional arguments: +.TP 15 +.PD +.B \-b \fIbang\fP +Hash-bang line to start the archive (e.g. #!/usr/bin/php). +The hash mark itself '#!' and the newline character are optional. +.TP +.PD +.B \-p \fIloader\fP +Location of PHP_Archive class file (pear list-files +PHP_Archive).You can use '0' or '1' to locate it +automatically using the mentioned pear command. When +using '0' the command does not error out when the class +file cannot be located. This switch also adds some code +around the stub so that class PHP_Archive gets +registered as phar:// stream wrapper if necessary. And +finally this switch will add the file phar.inc from +this package and load it to ensure class Phar is +present. +.TP +.PD +.B \-s \fIstub\fP +Select the \fIstub\fP file. + + +.SH tree command +Get a directory tree for a PHAR archive. +.P +Required arguments: +.TP 15 +.PD +.B -f \fIfile\fP +Specifies the phar \fIfile\fP to work on. +.P +Optional arguments: +.TP 15 +.PD +.B \-i \fIregex\fP +Specifies a regular expression for input files. +.TP +.PD +.B \-x \fIregex\fP +Regular expression for input files to exclude. + +.SH version command +Get information about the PHAR environment and the tool version. + + +.SH COMPRESSION +Algorithms: +.TP 15 +.PD +.B 0 +No compression +.TP +.PD +.B none +No compression +.TP +.PD +.B auto +Automatically select compression algorithm +.TP +.PD +.B gz +GZip compression +.TP +.PD +.B gzip +GZip compression +.TP +.PD +.B bz2 +BZip2 compression +.TP +.PD +.B bzip2 +BZip2 compression + +.SH HASH +Algorithms: +.TP 15 +.PD +.TP +.PD +.B md5 +MD5 +.TP +.PD +.B sha1 +SHA1 +.TP +.PD +.B sha256 +SHA256 +.TP +.PD +.B sha512 +SHA512 +.TP +.PD +.B openssl +OpenSSL + +.SH SEE ALSO +For a more or less complete description of PHAR look here: +.PD 0 +.P +.B http://php.net/phar +.PD 1 +.P +.SH BUGS +You can view the list of known bugs or report any new bug you +found at: +.PD 0 +.P +.B http://bugs.php.net +.PD 1 +.SH AUTHORS +The PHP Group: Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski. +.P +Work for the PHP archive was done by Gregory Beaver, Marcus Boerger. +.P +A List of active developers can be found here: +.PD 0 +.P +.B http://www.php.net/credits.php +.PD 1 +.P +And last but not least PHP was developed with the help of a huge amount of +contributors all around the world. +.SH VERSION INFORMATION +This manpage describes \fBphar\fP, version @PHP_VERSION@. +.SH COPYRIGHT +Copyright \(co 1997\-2013 The PHP Group +.LP +This source file is subject to version 3.01 of the PHP license, +that is bundled with this package in the file LICENSE, and is +available through the world-wide-web at the following url: +.PD 0 +.P +.B http://www.php.net/license/3_01.txt +.PD 1 +.P +If you did not receive a copy of the PHP license and are unable to +obtain it through the world-wide-web, please send a note to +.B license@php.net +so we can mail you a copy immediately. diff --git a/ext/phar/phar.phar.1.in b/ext/phar/phar.phar.1.in new file mode 100644 index 000000000..b5eecbfeb --- /dev/null +++ b/ext/phar/phar.phar.1.in @@ -0,0 +1 @@ +.so man1/phar.1 diff --git a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt index 465e868cf..dfec951f7 100644 --- a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt +++ b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -ReflectionExtension::getClassNames() method on an extension which acually returns some information +ReflectionExtension::getClassNames() method on an extension which actually returns some information --CREDITS-- Felix De Vliegher <felix.devliegher@gmail.com> --FILE-- diff --git a/ext/reflection/tests/bug64936.phpt b/ext/reflection/tests/bug64936.phpt index 578dc7e4c..363a17f50 100644 --- a/ext/reflection/tests/bug64936.phpt +++ b/ext/reflection/tests/bug64936.phpt @@ -3,6 +3,10 @@ ReflectionMethod::getDocComment() uses left over doc comment from previous scann --INI-- opcache.save_comments=1 opcache.load_comments=1 +--SKIPIF-- +<?php +if (!extension_loaded('reflection') || !extension_loaded('tokenizer')) print 'skip missing reflection of tokernizer extension'; +?> --FILE-- <?php diff --git a/ext/session/mod_files.sh b/ext/session/mod_files.sh index 1d2672847..4fc4f20f7 100644 --- a/ext/session/mod_files.sh +++ b/ext/session/mod_files.sh @@ -1,24 +1,65 @@ #! /bin/sh -if test "$2" = ""; then - echo "usage: $0 basedir depth" - exit 1 +if [[ "$2" = "" ]] || [[ "$3" = "" ]]; then + echo "Usage: $0 BASE_DIRECTORY DEPTH HASH_BITS" + echo "BASE_DIRECTORY will be created if it doesn't exist" + echo "DEPTH must be an integer number >0" + echo "HASH_BITS(session.hash_bits_per_charactor) should be one of 4, 5, or 6" + exit 1 fi -if test "$2" = "0"; then - exit 0 +if [[ "$2" = "0" ]] && [[ ! "$4" = "recurse" ]]; then + echo "Can't create a directory tree with depth of 0, exiting." fi +if [[ "$2" = "0" ]]; then + exit 0 +fi + +directory="$1" +depth="$2" +hashbits="$3" + hash_chars="0 1 2 3 4 5 6 7 8 9 a b c d e f" -if test "$3" -a "$3" -ge "5"; then - hash_chars="$hash_chars g h i j k l m n o p q r s t u v" - if test "$3" -eq "6"; then - hash_chars="$hash_chars w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - ," - fi + +if [[ "$hashbits" -ge "5" ]]; then + hash_chars="$hash_chars g h i j k l m n o p q r s t u v" fi +if [[ "$hashbits" -ge "6" ]]; then + hash_chars="$hash_chars w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - ," +fi + +while [[ -d $directory ]] && [[ $( ls $directory ) ]]; do + echo "Directory $directory is not empty! What would you like to do?" + + options="\"Delete directory contents\" \"Choose another directory\" \"Quit\"" + eval set $options + select opt in "$@"; do + + if [[ $opt = "Delete directory contents" ]]; then + echo "Deleting $directory contents... " + rm -rf $directory/* + elif [[ $opt = "Choose another directory" ]]; then + echo "Which directory would you like to choose?" + read directory + elif [[ $opt = "Quit" ]]; then + exit 0 + fi + + break; + done +done + +if [[ ! -d $directory ]]; then + mkdir -p $directory +fi + + +echo "Creating session path in $directory with a depth of $depth for session.hash_bits_per_character = $hashbits" + for i in $hash_chars; do - newpath="$1/$i" - mkdir $newpath || exit 1 - sh $0 $newpath `expr $2 - 1` $3 + newpath="$directory/$i" + mkdir $newpath || exit 1 + sh $0 $newpath `expr $depth - 1` $hashbits recurse done diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c index e5406d0bc..e0d16d192 100644 --- a/ext/session/mod_mm.c +++ b/ext/session/mod_mm.c @@ -271,6 +271,8 @@ PHP_MINIT_FUNCTION(ps_mm) } if (!(euid_len = slprintf(euid, sizeof(euid), "%d", geteuid()))) { + free(ps_mm_instance); + ps_mm_instance = NULL; return FAILURE; } diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 57d7bd0ed..82fd419fc 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -23,7 +23,7 @@ #include "mod_user.h" ps_module ps_mod_user = { - PS_MOD(user) + PS_MOD_SID(user) }; #define SESS_ZVAL_LONG(val, a) \ @@ -183,6 +183,38 @@ PS_GC_FUNC(user) FINISH; } +PS_CREATE_SID_FUNC(user) +{ + /* maintain backwards compatibility */ + if (PSF(create_sid) != NULL) { + char *id = NULL; + STDVARS; + + retval = ps_call_handler(PSF(create_sid), 0, NULL TSRMLS_CC); + + if (retval) { + if (Z_TYPE_P(retval) == IS_STRING) { + id = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + } + zval_ptr_dtor(&retval); + } + else { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "No session id returned by function"); + return NULL; + } + + if (!id) { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Session id must be a string"); + return NULL; + } + + return id; + } + + /* function as defined by PS_MOD */ + return php_session_create_id(mod_data, newlen TSRMLS_CC); +} + /* * Local variables: * tab-width: 4 diff --git a/ext/session/mod_user.h b/ext/session/mod_user.h index fd149ccff..6b2998c42 100644 --- a/ext/session/mod_user.h +++ b/ext/session/mod_user.h @@ -24,6 +24,6 @@ extern ps_module ps_mod_user; #define ps_user_ptr &ps_mod_user -PS_FUNCS(user); +PS_FUNCS_SID(user); #endif diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c index 1ed1e7bbd..ea53af9eb 100644 --- a/ext/session/mod_user_class.c +++ b/ext/session/mod_user_class.c @@ -141,3 +141,19 @@ PHP_METHOD(SessionHandler, gc) RETVAL_BOOL(SUCCESS == PS(default_mod)->s_gc(&PS(mod_data), maxlifetime, &nrdels TSRMLS_CC)); } /* }}} */ + +/* {{{ proto char SessionHandler::create_sid() + Wraps the old create_sid handler */ +PHP_METHOD(SessionHandler, create_sid) +{ + char *id; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + id = PS(default_mod)->s_create_sid(&PS(mod_data), NULL TSRMLS_CC); + + RETURN_STRING(id, 0); +} +/* }}} */ diff --git a/ext/session/php_session.h b/ext/session/php_session.h index adc5e7040..1dd5b1a1a 100644 --- a/ext/session/php_session.h +++ b/ext/session/php_session.h @@ -138,7 +138,7 @@ typedef struct _php_ps_globals { int module_number; long cache_expire; union { - zval *names[6]; + zval *names[7]; struct { zval *ps_open; zval *ps_close; @@ -146,6 +146,7 @@ typedef struct _php_ps_globals { zval *ps_write; zval *ps_destroy; zval *ps_gc; + zval *ps_create_sid; } name; } mod_user_names; int mod_user_implemented; @@ -277,11 +278,15 @@ extern zend_class_entry *php_session_class_entry; #define PS_IFACE_NAME "SessionHandlerInterface" extern zend_class_entry *php_session_iface_entry; +#define PS_SID_IFACE_NAME "SessionIdInterface" +extern zend_class_entry *php_session_id_iface_entry; + extern PHP_METHOD(SessionHandler, open); extern PHP_METHOD(SessionHandler, close); extern PHP_METHOD(SessionHandler, read); extern PHP_METHOD(SessionHandler, write); extern PHP_METHOD(SessionHandler, destroy); extern PHP_METHOD(SessionHandler, gc); +extern PHP_METHOD(SessionHandler, create_sid); #endif diff --git a/ext/session/session.c b/ext/session/session.c index 5e0565253..e992f31d2 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -70,6 +70,9 @@ zend_class_entry *php_session_class_entry; /* SessionHandlerInterface */ zend_class_entry *php_session_iface_entry; +/* SessionIdInterface */ +zend_class_entry *php_session_id_iface_entry; + /* *********** * Helpers * *********** */ @@ -615,6 +618,31 @@ static PHP_INI_MH(OnUpdateSaveDir) /* {{{ */ } /* }}} */ +static PHP_INI_MH(OnUpdateName) /* {{{ */ +{ + /* Numeric session.name won't work at all */ + if (PG(modules_activated) && + (!new_value_length || is_numeric_string(new_value, new_value_length, NULL, NULL, 0))) { + int err_type; + + if (stage == ZEND_INI_STAGE_RUNTIME) { + err_type = E_WARNING; + } else { + err_type = E_ERROR; + } + + /* Do not output error when restoring ini options. */ + if (stage != ZEND_INI_STAGE_DEACTIVATE) { + php_error_docref(NULL TSRMLS_CC, err_type, "session.name cannot be a numeric or empty '%s'", new_value); + } + return FAILURE; + } + + OnUpdateStringUnempty(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + return SUCCESS; +} +/* }}} */ + static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */ { long val; @@ -706,7 +734,7 @@ static ZEND_INI_MH(OnUpdateSmartStr) /* {{{ */ */ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("session.save_path", "", PHP_INI_ALL, OnUpdateSaveDir,save_path, php_ps_globals, ps_globals) - STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateString, session_name, php_ps_globals, ps_globals) + STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateName, session_name, php_ps_globals, ps_globals) PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, OnUpdateSaveHandler) STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_ALL, OnUpdateBool, auto_start, php_ps_globals, ps_globals) STD_PHP_INI_ENTRY("session.gc_probability", "1", PHP_INI_ALL, OnUpdateLong, gc_probability, php_ps_globals, ps_globals) @@ -1027,7 +1055,7 @@ static inline void strcpy_gmt(char *ubuf, time_t *when) /* {{{ */ res = php_gmtime_r(when, &tm); if (!res) { - buf[0] = '\0'; + ubuf[0] = '\0'; return; } @@ -1577,7 +1605,7 @@ static PHP_FUNCTION(session_module_name) } /* }}} */ -/* {{{ proto void session_set_save_handler(string open, string close, string read, string write, string destroy, string gc) +/* {{{ proto void session_set_save_handler(string open, string close, string read, string write, string destroy, string gc, string create_sid) Sets user-level functions */ static PHP_FUNCTION(session_set_save_handler) { @@ -1589,11 +1617,7 @@ static PHP_FUNCTION(session_set_save_handler) RETURN_FALSE; } - if (argc != 1 && argc != 2 && argc != 6) { - WRONG_PARAM_COUNT; - } - - if (argc <= 2) { + if (argc > 0 && argc <= 2) { zval *obj = NULL, *callback = NULL; zend_uint func_name_len; char *func_name; @@ -1607,11 +1631,11 @@ static PHP_FUNCTION(session_set_save_handler) RETURN_FALSE; } - /* Find implemented methods */ - zend_hash_internal_pointer_reset_ex(&php_session_class_entry->function_table, &pos); + /* Find implemented methods - SessionHandlerInterface */ + zend_hash_internal_pointer_reset_ex(&php_session_iface_entry->function_table, &pos); i = 0; - while (zend_hash_get_current_data_ex(&php_session_class_entry->function_table, (void **) &default_mptr, &pos) == SUCCESS) { - zend_hash_get_current_key_ex(&php_session_class_entry->function_table, &func_name, &func_name_len, &func_index, 0, &pos); + while (zend_hash_get_current_data_ex(&php_session_iface_entry->function_table, (void **) &default_mptr, &pos) == SUCCESS) { + zend_hash_get_current_key_ex(&php_session_iface_entry->function_table, &func_name, &func_name_len, &func_index, 0, &pos); if (zend_hash_find(&Z_OBJCE_P(obj)->function_table, func_name, func_name_len, (void **)¤t_mptr) == SUCCESS) { if (PS(mod_user_names).names[i] != NULL) { @@ -1629,7 +1653,29 @@ static PHP_FUNCTION(session_set_save_handler) RETURN_FALSE; } - zend_hash_move_forward_ex(&php_session_class_entry->function_table, &pos); + zend_hash_move_forward_ex(&php_session_iface_entry->function_table, &pos); + ++i; + } + + /* Find implemented methods - SessionIdInterface (optional) */ + zend_hash_internal_pointer_reset_ex(&php_session_id_iface_entry->function_table, &pos); + while (zend_hash_get_current_data_ex(&php_session_id_iface_entry->function_table, (void **) &default_mptr, &pos) == SUCCESS) { + zend_hash_get_current_key_ex(&php_session_id_iface_entry->function_table, &func_name, &func_name_len, &func_index, 0, &pos); + + if (zend_hash_find(&Z_OBJCE_P(obj)->function_table, func_name, func_name_len, (void **)¤t_mptr) == SUCCESS) { + if (PS(mod_user_names).names[i] != NULL) { + zval_ptr_dtor(&PS(mod_user_names).names[i]); + } + + MAKE_STD_ZVAL(callback); + array_init_size(callback, 2); + Z_ADDREF_P(obj); + add_next_index_zval(callback, obj); + add_next_index_stringl(callback, func_name, func_name_len - 1, 1); + PS(mod_user_names).names[i] = callback; + } + + zend_hash_move_forward_ex(&php_session_id_iface_entry->function_table, &pos); ++i; } @@ -1661,6 +1707,10 @@ static PHP_FUNCTION(session_set_save_handler) RETURN_TRUE; } + if (argc != 6 && argc != 7) { + WRONG_PARAM_COUNT; + } + if (zend_parse_parameters(argc TSRMLS_CC, "+", &args, &num_args) == FAILURE) { return; } @@ -1668,7 +1718,8 @@ static PHP_FUNCTION(session_set_save_handler) /* remove shutdown function */ remove_user_shutdown_function("session_shutdown", sizeof("session_shutdown") TSRMLS_CC); - for (i = 0; i < 6; i++) { + /* at this point argc can only be 6 or 7 */ + for (i = 0; i < argc; i++) { if (!zend_is_callable(*args[i], 0, &name TSRMLS_CC)) { efree(args); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument %d is not a valid callback", i+1); @@ -1682,7 +1733,7 @@ static PHP_FUNCTION(session_set_save_handler) zend_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } - for (i = 0; i < 6; i++) { + for (i = 0; i < argc; i++) { if (PS(mod_user_names).names[i] != NULL) { zval_ptr_dtor(&PS(mod_user_names).names[i]); } @@ -1992,13 +2043,14 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_session_void, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_session_set_save_handler, 0, 0, 6) +ZEND_BEGIN_ARG_INFO_EX(arginfo_session_set_save_handler, 0, 0, 1) ZEND_ARG_INFO(0, open) ZEND_ARG_INFO(0, close) ZEND_ARG_INFO(0, read) ZEND_ARG_INFO(0, write) ZEND_ARG_INFO(0, destroy) ZEND_ARG_INFO(0, gc) + ZEND_ARG_INFO(0, create_sid) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_session_cache_limiter, 0, 0, 0) @@ -2041,6 +2093,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_session_class_gc, 0) ZEND_ARG_INFO(0, maxlifetime) ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_session_class_create_sid, 0) +ZEND_END_ARG_INFO() /* }}} */ /* {{{ session_functions[] @@ -2082,6 +2137,14 @@ static const zend_function_entry php_session_iface_functions[] = { }; /* }}} */ +/* {{{ SessionIdInterface functions[] +*/ +static const zend_function_entry php_session_id_iface_functions[] = { + PHP_ABSTRACT_ME(SessionIdInterface, create_sid, arginfo_session_class_create_sid) + { NULL, NULL, NULL } +}; +/* }}} */ + /* {{{ SessionHandler functions[] */ static const zend_function_entry php_session_class_functions[] = { @@ -2091,6 +2154,7 @@ static const zend_function_entry php_session_class_functions[] = { PHP_ME(SessionHandler, write, arginfo_session_class_write, ZEND_ACC_PUBLIC) PHP_ME(SessionHandler, destroy, arginfo_session_class_destroy, ZEND_ACC_PUBLIC) PHP_ME(SessionHandler, gc, arginfo_session_class_gc, ZEND_ACC_PUBLIC) + PHP_ME(SessionHandler, create_sid, arginfo_session_class_create_sid, ZEND_ACC_PUBLIC) { NULL, NULL, NULL } }; /* }}} */ @@ -2150,7 +2214,7 @@ static PHP_RSHUTDOWN_FUNCTION(session) /* {{{ */ php_rshutdown_session_globals(TSRMLS_C); /* this should NOT be done in php_rshutdown_session_globals() */ - for (i = 0; i < 6; i++) { + for (i = 0; i < 7; i++) { if (PS(mod_user_names).names[i] != NULL) { zval_ptr_dtor(&PS(mod_user_names).names[i]); PS(mod_user_names).names[i] = NULL; @@ -2175,7 +2239,7 @@ static PHP_GINIT_FUNCTION(ps) /* {{{ */ ps_globals->default_mod = NULL; ps_globals->mod_user_implemented = 0; ps_globals->mod_user_is_open = 0; - for (i = 0; i < 6; i++) { + for (i = 0; i < 7; i++) { ps_globals->mod_user_names.names[i] = NULL; } ps_globals->http_session_vars = NULL; @@ -2199,15 +2263,20 @@ static PHP_MINIT_FUNCTION(session) /* {{{ */ php_session_rfc1867_orig_callback = php_rfc1867_callback; php_rfc1867_callback = php_session_rfc1867_callback; - /* Register interface */ + /* Register interfaces */ INIT_CLASS_ENTRY(ce, PS_IFACE_NAME, php_session_iface_functions); php_session_iface_entry = zend_register_internal_class(&ce TSRMLS_CC); php_session_iface_entry->ce_flags |= ZEND_ACC_INTERFACE; + INIT_CLASS_ENTRY(ce, PS_SID_IFACE_NAME, php_session_id_iface_functions); + php_session_id_iface_entry = zend_register_internal_class(&ce TSRMLS_CC); + php_session_id_iface_entry->ce_flags |= ZEND_ACC_INTERFACE; + /* Register base class */ INIT_CLASS_ENTRY(ce, PS_CLASS_NAME, php_session_class_functions); php_session_class_entry = zend_register_internal_class(&ce TSRMLS_CC); zend_class_implements(php_session_class_entry TSRMLS_CC, 1, php_session_iface_entry); + zend_class_implements(php_session_class_entry TSRMLS_CC, 1, php_session_id_iface_entry); REGISTER_LONG_CONSTANT("PHP_SESSION_DISABLED", php_session_disabled, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PHP_SESSION_NONE", php_session_none, CONST_CS | CONST_PERSISTENT); @@ -2225,8 +2294,11 @@ static PHP_MSHUTDOWN_FUNCTION(session) /* {{{ */ PHP_MSHUTDOWN(ps_mm) (SHUTDOWN_FUNC_ARGS_PASSTHRU); #endif - /* restore the orig callback */ - php_rfc1867_callback = php_session_rfc1867_orig_callback; + /* reset rfc1867 callbacks */ + php_session_rfc1867_orig_callback = NULL; + if (php_rfc1867_callback == php_session_rfc1867_callback) { + php_rfc1867_callback = NULL; + } ps_serializers[PREDEFINED_SERIALIZERS].name = NULL; memset(&ps_modules[PREDEFINED_MODULES], 0, (MAX_MODULES-PREDEFINED_MODULES)*sizeof(ps_module *)); @@ -2370,7 +2442,7 @@ static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, i php_session_initialize(TSRMLS_C); PS(session_status) = php_session_active; IF_SESSION_VARS() { - progress->cancel_upload = php_check_cancel_upload(progress TSRMLS_CC); + progress->cancel_upload |= php_check_cancel_upload(progress TSRMLS_CC); ZEND_SET_SYMBOL_WITH_LENGTH(Z_ARRVAL_P(PS(http_session_vars)), progress->key.c, progress->key.len+1, progress->data, 2, 0); } php_session_flush(TSRMLS_C); diff --git a/ext/session/tests/bug50308.phpt b/ext/session/tests/bug50308.phpt new file mode 100644 index 000000000..110277ce3 --- /dev/null +++ b/ext/session/tests/bug50308.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #50308 (session id not appended properly for empty anchor tags) +--SKIPIF-- +<?php include('skipif.inc'); ?> +--INI-- +session.name=PHPSESSID +session.save_handler=files +session.use_trans_sid=1 +session.use_only_cookies=0 +--FILE-- +<?php +@session_start(); +?> +<a href=""/> +<a href="" /> +<a href="foo"/> +<a href="foo" /> +<a href=foo/> +<a href=/> +<a href=?foo=bar/> +<a href="?foo=bar"/> +--EXPECTF-- +<a href="?PHPSESSID=%s"/> +<a href="?PHPSESSID=%s" /> +<a href="foo?PHPSESSID=%s"/> +<a href="foo?PHPSESSID=%s" /> +<a href=foo/?PHPSESSID=%s> +<a href=/?PHPSESSID=%s> +<a href=?foo=bar/&PHPSESSID=%s> +<a href="?foo=bar&PHPSESSID=%s"/> diff --git a/ext/session/tests/session_name_error.phpt b/ext/session/tests/session_name_error.phpt index 2ed10d92a..1b99d4ea3 100644 --- a/ext/session/tests/session_name_error.phpt +++ b/ext/session/tests/session_name_error.phpt @@ -86,7 +86,7 @@ $inputs = array( $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; - var_dump(session_name($input)); + var_dump($input, session_name($input)); $iterator++; }; @@ -98,77 +98,139 @@ ob_end_flush(); *** Testing session_name() : error functionality *** -- Iteration 1 -- + +Warning: session_name(): session.name cannot be a numeric or empty '0' in %s on line %d +int(0) string(9) "PHPSESSID" -- Iteration 2 -- -string(1) "0" + +Warning: session_name(): session.name cannot be a numeric or empty '1' in %s on line %d +int(1) +string(9) "PHPSESSID" -- Iteration 3 -- -string(1) "1" + +Warning: session_name(): session.name cannot be a numeric or empty '12345' in %s on line %d +int(12345) +string(9) "PHPSESSID" -- Iteration 4 -- -string(5) "12345" + +Warning: session_name(): session.name cannot be a numeric or empty '-2345' in %s on line %d +int(-2345) +string(9) "PHPSESSID" -- Iteration 5 -- -string(5) "-2345" + +Warning: session_name(): session.name cannot be a numeric or empty '10.5' in %s on line %d +float(10.5) +string(9) "PHPSESSID" -- Iteration 6 -- -string(4) "10.5" + +Warning: session_name(): session.name cannot be a numeric or empty '-10.5' in %s on line %d +float(-10.5) +string(9) "PHPSESSID" -- Iteration 7 -- -string(5) "-10.5" + +Warning: session_name(): session.name cannot be a numeric or empty '123456789000' in %s on line %d +float(123456789000) +string(9) "PHPSESSID" -- Iteration 8 -- -string(12) "123456789000" + +Warning: session_name(): session.name cannot be a numeric or empty '1.23456789E-9' in %s on line %d +float(1.23456789E-9) +string(9) "PHPSESSID" -- Iteration 9 -- -string(13) "1.23456789E-9" + +Warning: session_name(): session.name cannot be a numeric or empty '0.5' in %s on line %d +float(0.5) +string(9) "PHPSESSID" -- Iteration 10 -- -string(3) "0.5" + +Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d +NULL +string(9) "PHPSESSID" -- Iteration 11 -- -string(0) "" + +Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d +NULL +string(9) "PHPSESSID" -- Iteration 12 -- -string(0) "" + +Warning: session_name(): session.name cannot be a numeric or empty '1' in %s on line %d +bool(true) +string(9) "PHPSESSID" -- Iteration 13 -- -string(1) "1" + +Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d +bool(false) +string(9) "PHPSESSID" -- Iteration 14 -- -string(0) "" + +Warning: session_name(): session.name cannot be a numeric or empty '1' in %s on line %d +bool(true) +string(9) "PHPSESSID" -- Iteration 15 -- -string(1) "1" + +Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d +bool(false) +string(9) "PHPSESSID" -- Iteration 16 -- + +Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d string(0) "" +string(9) "PHPSESSID" -- Iteration 17 -- + +Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d string(0) "" +string(9) "PHPSESSID" -- Iteration 18 -- -string(0) "" +string(7) "Nothing" +string(9) "PHPSESSID" -- Iteration 19 -- string(7) "Nothing" +string(7) "Nothing" -- Iteration 20 -- +string(12) "Hello World!" string(7) "Nothing" -- Iteration 21 -- +object(classA)#1 (0) { +} string(12) "Hello World!" -- Iteration 22 -- + +Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d +NULL string(12) "Hello World!" -- Iteration 23 -- -string(0) "" + +Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d +NULL +string(12) "Hello World!" -- Iteration 24 -- Warning: session_name() expects parameter 1 to be string, resource given in %s on line %d +resource(5) of type (stream) NULL -Done - +Done
\ No newline at end of file diff --git a/ext/session/tests/session_name_variation1.phpt b/ext/session/tests/session_name_variation1.phpt index 16d6ad462..b0de3ee36 100644 --- a/ext/session/tests/session_name_variation1.phpt +++ b/ext/session/tests/session_name_variation1.phpt @@ -43,18 +43,20 @@ ob_end_flush(); *** Testing session_name() : variation *** string(9) "PHPSESSID" bool(true) -string(0) "" +string(9) "PHPSESSID" bool(true) -string(0) "" -string(0) "" +string(9) "PHPSESSID" +string(9) "PHPSESSID" bool(true) string(1) " " bool(true) string(1) " " + +Warning: session_name(): session.name cannot be a numeric or empty '' in %s on line %d string(1) " " bool(true) -string(0) "" +string(1) " " bool(true) -string(0) "" +string(1) " " Done diff --git a/ext/session/tests/session_set_save_handler_class_016.phpt b/ext/session/tests/session_set_save_handler_class_016.phpt new file mode 100644 index 000000000..2de03c068 --- /dev/null +++ b/ext/session/tests/session_set_save_handler_class_016.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test session_set_save_handler() function: class with create_sid +--INI-- +session.save_handler=files +session.name=PHPSESSID +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : bool session_set_save_handler(SessionHandlerInterface $handler [, bool $register_shutdown_function = true]) + * Description : Sets user-level session storage functions + * Source code : ext/session/session.c + */ + +echo "*** Testing session_set_save_handler() function: class with create_sid ***\n"; + +class MySession2 extends SessionHandler { + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return @file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return file_put_contents($this->path . $id, $data); + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } + + public function create_sid() { + return parent::create_sid(); + } +} + +$handler = new MySession2; +session_set_save_handler($handler); +session_start(); + +$_SESSION['foo'] = "hello"; + +var_dump(session_id(), ini_get('session.save_handler'), $_SESSION); + +session_write_close(); +session_unset(); + +session_start(); +var_dump($_SESSION); + +session_write_close(); +session_unset(); + +--EXPECTF-- +*** Testing session_set_save_handler() function: class with create_sid *** +string(%d) "%s" +string(4) "user" +array(1) { + ["foo"]=> + string(5) "hello" +} +array(1) { + ["foo"]=> + string(5) "hello" +} diff --git a/ext/session/tests/session_set_save_handler_class_017.phpt b/ext/session/tests/session_set_save_handler_class_017.phpt new file mode 100644 index 000000000..756dc55d0 --- /dev/null +++ b/ext/session/tests/session_set_save_handler_class_017.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test session_set_save_handler() function: class with create_sid +--INI-- +session.save_handler=files +session.name=PHPSESSID +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : bool session_set_save_handler(SessionHandlerInterface $handler [, bool $register_shutdown_function = true]) + * Description : Sets user-level session storage functions + * Source code : ext/session/session.c + */ + +echo "*** Testing session_set_save_handler() function: class with create_sid ***\n"; + +class MySession2 extends SessionHandler { + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return @file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return file_put_contents($this->path . $id, $data); + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } + + public function create_sid() { + return 'my_sid'; + } +} + +$handler = new MySession2; +session_set_save_handler($handler); +session_start(); + +$_SESSION['foo'] = "hello"; + +var_dump(session_id(), ini_get('session.save_handler'), $_SESSION); + +session_write_close(); +session_unset(); + +session_start(); +var_dump($_SESSION); + +session_write_close(); +session_unset(); + +--EXPECTF-- +*** Testing session_set_save_handler() function: class with create_sid *** +string(%d) "my_sid" +string(4) "user" +array(1) { + ["foo"]=> + string(5) "hello" +} +array(1) { + ["foo"]=> + string(5) "hello" +} diff --git a/ext/session/tests/session_set_save_handler_iface_003.phpt b/ext/session/tests/session_set_save_handler_iface_003.phpt new file mode 100644 index 000000000..bd757dce6 --- /dev/null +++ b/ext/session/tests/session_set_save_handler_iface_003.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test session_set_save_handler() function: id interface +--INI-- +session.save_handler=files +session.name=PHPSESSID +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +/* + * Prototype : bool session_set_save_handler(SessionHandlerInterface $handler [, bool $register_shutdown_function = true]) + * Description : Sets user-level session storage functions + * Source code : ext/session/session.c + */ + +echo "*** Testing session_set_save_handler() function: id interface ***\n"; + +class MySession2 implements SessionHandlerInterface, SessionIdInterface { + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return @file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return file_put_contents($this->path . $id, $data); + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } + + public function create_sid() { + return 'my_sid'; + } +} + +$handler = new MySession2; +session_set_save_handler($handler); +session_start(); + +$_SESSION['foo'] = "hello"; + +var_dump(session_id(), ini_get('session.save_handler'), $_SESSION); + +session_write_close(); +session_unset(); + +session_start(); +var_dump($_SESSION); + +session_write_close(); +session_unset(); + +--EXPECTF-- +*** Testing session_set_save_handler() function: id interface *** +string(%d) "my_sid" +string(4) "user" +array(1) { + ["foo"]=> + string(5) "hello" +} +array(1) { + ["foo"]=> + string(5) "hello" +} diff --git a/ext/session/tests/session_set_save_handler_sid_001.phpt b/ext/session/tests/session_set_save_handler_sid_001.phpt new file mode 100644 index 000000000..0dc4fc11c --- /dev/null +++ b/ext/session/tests/session_set_save_handler_sid_001.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test session_set_save_handler() function: create_sid +--INI-- +session.save_handler=files +session.name=PHPSESSID +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +echo "*** Testing session_set_save_handler() function: create_sid ***\n"; + +class MySession2 { + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return @file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return file_put_contents($this->path . $id, $data); + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } + + public function create_sid() { + return 'my_sid'; + } +} + +$handler = new MySession2; +session_set_save_handler(array($handler, 'open'), array($handler, 'close'), + array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid')); +session_start(); + +$_SESSION['foo'] = "hello"; + +var_dump(session_id(), ini_get('session.save_handler'), $_SESSION); + +session_write_close(); +session_unset(); + +session_start(); +var_dump($_SESSION); + +session_write_close(); +session_unset(); + +--EXPECTF-- +*** Testing session_set_save_handler() function: create_sid *** +string(%d) "my_sid" +string(4) "user" +array(1) { + ["foo"]=> + string(5) "hello" +} +array(1) { + ["foo"]=> + string(5) "hello" +} diff --git a/ext/session/tests/session_set_save_handler_sid_002.phpt b/ext/session/tests/session_set_save_handler_sid_002.phpt new file mode 100644 index 000000000..f9a72aebc --- /dev/null +++ b/ext/session/tests/session_set_save_handler_sid_002.phpt @@ -0,0 +1,77 @@ +--TEST-- +Test session_set_save_handler() function: create_sid +--INI-- +session.save_handler=files +session.name=PHPSESSID +--SKIPIF-- +<?php include('skipif.inc'); ?> +--FILE-- +<?php + +ob_start(); + +echo "*** Testing session_set_save_handler() function: create_sid ***\n"; + +class MySession2 { + public $path; + + public function open($path, $name) { + if (!$path) { + $path = sys_get_temp_dir(); + } + $this->path = $path . '/u_sess_' . $name; + return true; + } + + public function close() { + return true; + } + + public function read($id) { + return @file_get_contents($this->path . $id); + } + + public function write($id, $data) { + return file_put_contents($this->path . $id, $data); + } + + public function destroy($id) { + @unlink($this->path . $id); + } + + public function gc($maxlifetime) { + foreach (glob($this->path . '*') as $filename) { + if (filemtime($filename) + $maxlifetime < time()) { + @unlink($filename); + } + } + return true; + } + + public function create_sid() { + return null; + } +} + +$handler = new MySession2; +session_set_save_handler(array($handler, 'open'), array($handler, 'close'), + array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid')); +session_start(); + +$_SESSION['foo'] = "hello"; + +var_dump(session_id(), ini_get('session.save_handler'), $_SESSION); + +session_write_close(); +session_unset(); + +session_start(); +var_dump($_SESSION); + +session_write_close(); +session_unset(); + +--EXPECTF-- +*** Testing session_set_save_handler() function: create_sid *** + +Fatal error: session_start(): Session id must be a string in %s on line %d diff --git a/ext/session/tests/session_status_disabled.phpt b/ext/session/tests/session_status_disabled.phpt index 24e0ecd7b..c4d1f2192 100644 --- a/ext/session/tests/session_status_disabled.phpt +++ b/ext/session/tests/session_status_disabled.phpt @@ -3,7 +3,7 @@ Test session_status() function : disabled --SKIPIF-- <?php include('skipif.inc'); ?> --INI-- -session.save_handler=non-existant +session.save_handler=non-existent --FILE-- <?php diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php index 5b978734e..b8ee893d8 100644 --- a/ext/soap/interop/client_round2_interop.php +++ b/ext/soap/interop/client_round2_interop.php @@ -300,7 +300,7 @@ class Interop_Client /** * decodeSoapval - * decodes a soap value to php type, used for test result comparisions + * decodes a soap value to php type, used for test result comparisons * * @param SOAP_Value soapval * @return mixed result @@ -398,7 +398,7 @@ class Interop_Client $namespace = $soapaction = 'http://soapinterop.org/'; // hack to make tests work with MS SoapToolkit // it's the only one that uses this soapaction, and breaks if - // it isn't right. Can't wait for soapaction to be fully depricated + // it isn't right. Can't wait for soapaction to be fully deprecated if ($this->currentTest == 'base' && strstr($endpoint_info['endpointName'],'MS SOAP ToolKit 2.0')) { $soapaction = 'urn:soapinterop'; diff --git a/ext/soap/interop/index.php b/ext/soap/interop/index.php index 1ae25d92f..fc12bc8cb 100644 --- a/ext/soap/interop/index.php +++ b/ext/soap/interop/index.php @@ -35,7 +35,7 @@ classes to define what the type of the value is.</p> <h3>Client Test Interface</h3> <p>The <a href="client_round2.php">client interface</a> allows you to run the PHP SOAP -Client against a choosen interop server. Each run updates the results database below.</p> +Client against a chosen interop server. Each run updates the results database below.</p> <h3>Interop Client Test Results</h3> <p>This is a database of the current test results using PHP SOAP Clients against interop servers.</p> diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 5af308c18..86ab03d9c 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -194,7 +194,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph if (use_ssl && !*use_proxy) { if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method"), (void **) &tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_LONG) { - /* uses contants declared in soap.c to determine ssl uri protocol */ + /* uses constants declared in soap.c to determine ssl uri protocol */ switch (Z_LVAL_PP(tmp)) { case SOAP_SSL_METHOD_TLS: protocol = "tls"; diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 8a41ff4e4..88aec53f4 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1290,7 +1290,7 @@ PHP_METHOD(SoapServer, setClass) } } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set a non existant class (%s)", classname); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set a non existent class (%s)", classname); return; } @@ -1421,7 +1421,7 @@ PHP_METHOD(SoapServer, addFunction) zend_str_tolower_copy(key, Z_STRVAL_PP(tmp_function), key_len); if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existant function '%s'", Z_STRVAL_PP(tmp_function)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_PP(tmp_function)); return; } @@ -1443,7 +1443,7 @@ PHP_METHOD(SoapServer, addFunction) zend_str_tolower_copy(key, Z_STRVAL_P(function_name), key_len); if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existant function '%s'", Z_STRVAL_P(function_name)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(function_name)); return; } if (service->soap_functions.ft == NULL) { diff --git a/ext/soap/tests/bugs/bug28985.phpt b/ext/soap/tests/bugs/bug28985.phpt index 59d96e2c7..5134cbf09 100644 --- a/ext/soap/tests/bugs/bug28985.phpt +++ b/ext/soap/tests/bugs/bug28985.phpt @@ -47,7 +47,7 @@ array(42) { string(86) "struct MGCodeLibelle { string Code; string Libelle; - boolean Defaut; + boolean Default; anyType Tag; }" [9]=> diff --git a/ext/soap/tests/bugs/bug28985.wsdl b/ext/soap/tests/bugs/bug28985.wsdl index ee528818b..50c2fcda8 100644 --- a/ext/soap/tests/bugs/bug28985.wsdl +++ b/ext/soap/tests/bugs/bug28985.wsdl @@ -67,7 +67,7 @@ type="s:string" /> type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Libelle"
type="s:string" />
- <s:element minOccurs="1" maxOccurs="1" name="Defaut"
+ <s:element minOccurs="1" maxOccurs="1" name="Default"
type="s:boolean" />
<s:element minOccurs="0" maxOccurs="1" name="Tag" />
</s:sequence>
diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index ea1c95201..ed55ed52f 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -98,8 +98,8 @@ typedef struct { } field_descriptor; #define KEY_FILL_SOCKADDR "fill_sockaddr" -#define KEY_RECVMSG_RET "recvmsg_ret" -#define KEY_CMSG_LEN "cmsg_len" +#define KEY_RECVMSG_RET "recvmsg_ret" +#define KEY_CMSG_LEN "cmsg_len" const struct key_value empty_key_value_list[] = {{0}}; @@ -223,6 +223,7 @@ static unsigned from_array_iterate(const zval *arr, char buf[sizeof("element #4294967295")]; char *bufp = buf; + /* Note i starts at 1, not 0! */ for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos), i = 1; !ctx->err.has_error && zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **)&elem, &pos) == SUCCESS; @@ -666,6 +667,13 @@ static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_ path = &lzval; } + /* code in this file relies on the path being nul terminated, even though + * this is not required, at least on linux for abstract paths. It also + * assumes that the path is not empty */ + if (Z_STRLEN_P(path) == 0) { + do_from_zval_err(ctx, "%s", "the path is cannot be empty"); + return; + } if (Z_STRLEN_P(path) >= sizeof(saddr->sun_path)) { do_from_zval_err(ctx, "the path is too long, the maximum permitted " "length is %ld", sizeof(saddr->sun_path) - 1); @@ -767,10 +775,22 @@ static void from_zval_write_sockaddr_aux(const zval *container, return; } *sockaddr_ptr = accounted_ecalloc(1, sizeof(struct sockaddr_un), ctx); - *sockaddr_len = sizeof(struct sockaddr_un); if (fill_sockaddr) { + struct sockaddr_un *sock_un = (struct sockaddr_un*)*sockaddr_ptr; + from_zval_write_sockaddr_un(container, (char*)*sockaddr_ptr, ctx); (*sockaddr_ptr)->sa_family = AF_UNIX; + + /* calculating length is more complicated here. Giving the size of + * struct sockaddr_un here and relying on the nul termination of + * sun_path does not work for paths in the abstract namespace. Note + * that we always assume the path is not empty and nul terminated */ + *sockaddr_len = offsetof(struct sockaddr_un, sun_path) + + (sock_un->sun_path[0] == '\0' + ? (1 + strlen(&sock_un->sun_path[1])) + : strlen(sock_un->sun_path)); + } else { + *sockaddr_len = sizeof(struct sockaddr_un); } break; @@ -869,7 +889,14 @@ static void from_zval_write_control(const zval *arr, } if (entry->calc_space) { - data_len = entry->calc_space(arr, ctx); + zval **data_elem; + /* arr must be an array at this point */ + if (zend_hash_find(Z_ARRVAL_P(arr), "data", sizeof("data"), + (void**)&data_elem) == FAILURE) { + do_from_zval_err(ctx, "cmsghdr should have a 'data' element here"); + return; + } + data_len = entry->calc_space(*data_elem, ctx); if (ctx->err.has_error) { return; } @@ -1370,7 +1397,7 @@ static void from_zval_write_fd_array_aux(zval **elem, unsigned i, void **args, s return; } - if (php_stream_cast(stream, PHP_STREAM_AS_FD, (void **)&iarr[i], + if (php_stream_cast(stream, PHP_STREAM_AS_FD, (void **)&iarr[i - 1], REPORT_ERRORS) == FAILURE) { do_from_zval_err(ctx, "cast stream to file descriptor failed"); return; diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 9b519b228..4a2a41b5f 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -64,6 +64,8 @@ # endif #endif +#include <stddef.h> + #include "sockaddr_conv.h" #include "multicast.h" #include "sendrecvmsg.h" @@ -344,7 +346,7 @@ const zend_function_entry sockets_functions[] = { PHP_FE(socket_recvmsg, arginfo_socket_recvmsg) PHP_FE(socket_cmsg_space, arginfo_socket_cmsg_space) - /* for downwards compatability */ + /* for downwards compatibility */ PHP_FALIAS(socket_getopt, socket_get_option, arginfo_socket_get_option) PHP_FALIAS(socket_setopt, socket_set_option, arginfo_socket_set_option) @@ -679,6 +681,9 @@ static PHP_MINIT_FUNCTION(sockets) REGISTER_LONG_CONSTANT("SO_FAMILY", SO_FAMILY, CONST_CS | CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT); +#ifdef SO_BINDTODEVICE + REGISTER_LONG_CONSTANT("SO_BINDTODEVICE", SO_BINDTODEVICE, CONST_CS | CONST_PERSISTENT); +#endif REGISTER_LONG_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT); #ifdef TCP_NODELAY @@ -1476,7 +1481,7 @@ PHP_FUNCTION(socket_strerror) PHP_FUNCTION(socket_bind) { zval *arg1; - php_sockaddr_storage sa_storage; + php_sockaddr_storage sa_storage = {0}; struct sockaddr *sock_type = (struct sockaddr*) &sa_storage; php_socket *php_sock; char *addr; @@ -1494,10 +1499,19 @@ PHP_FUNCTION(socket_bind) case AF_UNIX: { struct sockaddr_un *sa = (struct sockaddr_un *) sock_type; - memset(sa, 0, sizeof(sa_storage)); + sa->sun_family = AF_UNIX; - snprintf(sa->sun_path, 108, "%s", addr); - retval = bind(php_sock->bsd_socket, (struct sockaddr *) sa, SUN_LEN(sa)); + + if (addr_len >= sizeof(sa->sun_path)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "Invalid path: too long (maximum size is %d)", + (int)sizeof(sa->sun_path) - 1); + RETURN_FALSE; + } + memcpy(&sa->sun_path, addr, addr_len); + + retval = bind(php_sock->bsd_socket, (struct sockaddr *) sa, + offsetof(struct sockaddr_un, sun_path) + addr_len); break; } @@ -1505,8 +1519,6 @@ PHP_FUNCTION(socket_bind) { struct sockaddr_in *sa = (struct sockaddr_in *) sock_type; - memset(sa, 0, sizeof(sa_storage)); /* Apparently, Mac OSX needs this */ - sa->sin_family = AF_INET; sa->sin_port = htons((unsigned short) port); @@ -1522,8 +1534,6 @@ PHP_FUNCTION(socket_bind) { struct sockaddr_in6 *sa = (struct sockaddr_in6 *) sock_type; - memset(sa, 0, sizeof(sa_storage)); /* Apparently, Mac OSX needs this */ - sa->sin6_family = AF_INET6; sa->sin6_port = htons((unsigned short) port); @@ -2038,6 +2048,18 @@ PHP_FUNCTION(socket_set_option) #endif break; } +#ifdef SO_BINDTODEVICE + case SO_BINDTODEVICE: { + if (Z_TYPE_PP(arg4) == IS_STRING) { + opt_ptr = Z_STRVAL_PP(arg4); + optlen = Z_STRLEN_PP(arg4); + } else { + opt_ptr = ""; + optlen = 0; + } + break; + } +#endif default: default_case: diff --git a/ext/sockets/tests/socket_abstract_path.phpt b/ext/sockets/tests/socket_abstract_path.phpt new file mode 100644 index 000000000..816e5c11b --- /dev/null +++ b/ext/sockets/tests/socket_abstract_path.phpt @@ -0,0 +1,44 @@ +--TEST-- +Support for paths in the abstract namespace (bind, connect) +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) + die('skip sockets extension not available.'); + +if (PHP_OS != 'Linux') { + die('skip For Linux only'); +} +?> +--FILE-- +<?php +include __DIR__."/mcast_helpers.php.inc"; + +$path = "\x00/foo_bar"; + +echo "creating server socket\n"; +$servers = socket_create(AF_UNIX, SOCK_STREAM, 0) or die("err"); +socket_bind($servers, $path) or die("Could not bind"); +socket_listen($servers) or die("Could not listen"); +socket_set_nonblock($servers) or die("Could not put in non-blocking mode"); + +echo "creating client socket\n"; +$clients = socket_create(AF_UNIX, SOCK_STREAM, 0) or die("err"); +socket_connect($clients, $path) or die("Error connecting"); + +$conns = socket_accept($servers) or die("Could not accept connection"); + +$r = socket_sendmsg($clients, [ + //"name" => [ "addr" => $path, ], + "iov" => ["test ", "thing", "\n"], +], 0); +var_dump($r); +checktimeout($conns, 500); + +if (!socket_recv($conns, $buf, 20, 0)) die("recv"); +print_r($buf); +?> +--EXPECTF-- +creating server socket +creating client socket +int(11) +test thing diff --git a/ext/sockets/tests/socket_abstract_path_sendmsg.phpt b/ext/sockets/tests/socket_abstract_path_sendmsg.phpt new file mode 100644 index 000000000..5a9275a26 --- /dev/null +++ b/ext/sockets/tests/socket_abstract_path_sendmsg.phpt @@ -0,0 +1,40 @@ +--TEST-- +Support for paths in the abstract namespace (bind, sendmsg, recvmsg) +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) + die('skip sockets extension not available.'); + +if (PHP_OS != 'Linux') { + die('skip For Linux only'); +} +?> +--FILE-- +<?php +include __DIR__."/mcast_helpers.php.inc"; + +$path = "\x00/bar_foo"; + +echo "creating send socket\n"; +$sends1 = socket_create(AF_UNIX, SOCK_DGRAM, 0) or die("err"); +socket_set_nonblock($sends1) or die("Could not put in non-blocking mode"); + +echo "creating receive socket\n"; +$s = socket_create(AF_UNIX, SOCK_DGRAM, 0) or die("err"); +socket_bind($s, $path) or die("err"); + +$r = socket_sendmsg($sends1, [ + "name" => [ "path" => $path], + "iov" => ["test ", "thing", "\n"], +], 0); +var_dump($r); +checktimeout($s, 500); + +if (!socket_recv($s, $buf, 20, 0)) die("recv"); +print_r($buf); +?> +--EXPECTF-- +creating send socket +creating receive socket +int(11) +test thing diff --git a/ext/sockets/tests/socket_cmsg_rights.phpt b/ext/sockets/tests/socket_cmsg_rights.phpt index 8290f0388..8c1734a56 100644 --- a/ext/sockets/tests/socket_cmsg_rights.phpt +++ b/ext/sockets/tests/socket_cmsg_rights.phpt @@ -84,6 +84,7 @@ Array [0] => Resource id #%d [1] => Resource id #%d [2] => Resource id #%d + [3] => Resource id #%d ) ) diff --git a/ext/sockets/tests/socket_set_option_bindtodevice.phpt b/ext/sockets/tests/socket_set_option_bindtodevice.phpt new file mode 100644 index 000000000..05d718ce6 --- /dev/null +++ b/ext/sockets/tests/socket_set_option_bindtodevice.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test if socket_set_option() works, option:SO_BINDTODEVICE +--DESCRIPTION-- +-Bind to loopback 'lo' device (should exist) +-Bind to unexisting device +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('SKIP sockets extension not available.'); +} +if (!defined("SO_BINDTODEVICE")) { + die('SKIP SO_BINDTODEVICE not supported on this platform.'); +} +if (!function_exists("posix_getuid") || posix_getuid() != 0) { + die('SKIP SO_BINDTODEVICE requires root permissions.'); +} +?> +--FILE-- +<?php +$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); + +if (!$socket) { + die('Unable to create AF_INET socket [socket]'); +} +// wrong params +$retval_1 = socket_set_option( $socket, SOL_SOCKET, SO_BINDTODEVICE, "lo"); +var_dump($retval_1); +$retval_2 = socket_set_option( $socket, SOL_SOCKET, SO_BINDTODEVICE, "ethIDONOTEXIST"); +var_dump($retval_2); + +socket_close($socket); +?> + +--EXPECTF-- +bool(true) + +Warning: socket_set_option(): unable to set socket option [19]: No such device in %s on line %d +bool(false) +--CREDITS-- +Damjan Cvetko, foreach.org diff --git a/ext/spl/internal/iteratoriterator.inc b/ext/spl/internal/iteratoriterator.inc index 37676e053..451d05da3 100644 --- a/ext/spl/internal/iteratoriterator.inc +++ b/ext/spl/internal/iteratoriterator.inc @@ -17,7 +17,7 @@ * an Iterator. It is very important to understand that most classes that do * not implement Iterator have their reasone to. Most likely they do not allow * the full Iterator feature set. If so you need to provide techniques to - * prevent missuse. If you do not you must expect exceptions or fatal erros. + * prevent missuse. If you do not you must expect exceptions or fatal errors. * * It is also possible to derive the class and implement IteratorAggregate by * downcasting the instances returned in getIterator. See the following diff --git a/ext/spl/internal/multipleiterator.inc b/ext/spl/internal/multipleiterator.inc index 2ed71d53a..12df011ec 100644 --- a/ext/spl/internal/multipleiterator.inc +++ b/ext/spl/internal/multipleiterator.inc @@ -163,7 +163,7 @@ class MultipleIterator implements Iterator $retval = array(); foreach($this->iterators as $iter) { - if ($it->valid()) + if ($iter->valid()) { if ($this->flags & self::MIT_KEYS_ASSOC) { @@ -205,7 +205,7 @@ class MultipleIterator implements Iterator $retval = array(); foreach($this->iterators as $iter) { - if ($it->valid()) + if ($iter->valid()) { $retval[] = $iter->key(); } diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index edeade375..ed13b8e57 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -1766,7 +1766,7 @@ SPL_METHOD(Array, unserialize) ++p; if (*p!='m') { - if (*p!='a' && *p!='O' && *p!='C') { + if (*p!='a' && *p!='O' && *p!='C' && *p!='r') { goto outexcept; } intern->ar_flags &= ~SPL_ARRAY_CLONE_MASK; diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index cf653f689..1a417d0f5 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -710,6 +710,12 @@ void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, long ctor_fla } intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + if (intern->_path) { + /* object is alreay initialized */ + zend_restore_error_handling(&error_handling TSRMLS_CC); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Directory object is already initialized"); + return; + } intern->flags = flags; #ifdef HAVE_GLOB if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_GLOB) && strstr(path, "glob://") != path) { @@ -1504,7 +1510,7 @@ SPL_METHOD(RecursiveDirectoryIterator, hasChildren) Returns an iterator for the current entry if it is a directory */ SPL_METHOD(RecursiveDirectoryIterator, getChildren) { - zval zpath, zflags; + zval *zpath, *zflags; spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_filesystem_object *subdir; char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH; @@ -1518,11 +1524,13 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren) if (SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) { RETURN_STRINGL(intern->file_name, intern->file_name_len, 1); } else { - INIT_PZVAL(&zflags); - INIT_PZVAL(&zpath); - ZVAL_LONG(&zflags, intern->flags); - ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len, 0); - spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), &return_value, 0, &zpath, &zflags TSRMLS_CC); + MAKE_STD_ZVAL(zflags); + MAKE_STD_ZVAL(zpath); + ZVAL_LONG(zflags, intern->flags); + ZVAL_STRINGL(zpath, intern->file_name, intern->file_name_len, 1); + spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), &return_value, 0, zpath, zflags TSRMLS_CC); + zval_ptr_dtor(&zpath); + zval_ptr_dtor(&zflags); subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC); if (subdir) { diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt index 32705f091..4402d6ca4 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -SplFileObject::fgetcsv with alternative delimeter +SplFileObject::fgetcsv with alternative delimiter --FILE-- <?php $fp = fopen('SplFileObject__fgetcsv.csv', 'w+'); diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt index 942c7619d..64d6514a2 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt @@ -1,5 +1,5 @@ --TEST-- -SplFileObject::fgetcsv with alternative delimeter +SplFileObject::fgetcsv with alternative delimiter --FILE-- <?php $fp = fopen('SplFileObject__fgetcsv.csv', 'w+'); diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt index ee2497252..efbb5fb68 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -SplFileObject::fgetcsv with alternative delimeter +SplFileObject::fgetcsv with alternative delimiter --FILE-- <?php $fp = fopen('SplFileObject__fgetcsv.csv', 'w+'); diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt index 5430e5375..7487b8353 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt @@ -1,5 +1,5 @@ --TEST-- -SplFileObject::fgetcsv with alternative delimeter +SplFileObject::fgetcsv with alternative delimiter --FILE-- <?php $fp = fopen('SplFileObject__fgetcsv.csv', 'w+'); diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt index 96c029095..1a94532b2 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -SplFileObject::fgetcsv with alternative delimeter +SplFileObject::fgetcsv with alternative delimiter --FILE-- <?php $fp = fopen('SplFileObject__fgetcsv.csv', 'w+'); diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt index a57031899..fd90103bf 100644 --- a/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt +++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_error.phpt @@ -1,5 +1,5 @@ --TEST-- -SplFileObject::fgetcsv with alternative delimeter +SplFileObject::fgetcsv with alternative delimiter --FILE-- <?php $fp = fopen('SplFileObject__fgetcsv.csv', 'w+'); diff --git a/ext/spl/tests/SplFileObject_rewind_error001.phpt b/ext/spl/tests/SplFileObject_rewind_error001.phpt index bdb3301e6..ac536a0a4 100644 --- a/ext/spl/tests/SplFileObject_rewind_error001.phpt +++ b/ext/spl/tests/SplFileObject_rewind_error001.phpt @@ -14,5 +14,9 @@ $fo = new SplFileObject('testdata.csv'); $fo->rewind( "invalid" ); ?> +--CLEAN-- +<?php +unlink('testdata.csv'); +?> --EXPECTF-- Warning: SplFileObject::rewind() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/bug61828.phpt b/ext/spl/tests/bug61828.phpt new file mode 100644 index 000000000..04d435e6d --- /dev/null +++ b/ext/spl/tests/bug61828.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #61828 (Memleak when calling Directory(Recursive)Iterator/Spl(Temp)FileObject ctor twice) +--FILE-- +<?php +$x = new DirectoryIterator('.'); +$x->__construct('/tmp'); +echo "Okey"; +?> +--EXPECTF-- +Warning: DirectoryIterator::__construct(): Directory object is already initialized in %sbug61828.php on line 3 +Okey diff --git a/ext/spl/tests/bug62672.phpt b/ext/spl/tests/bug62672.phpt new file mode 100644 index 000000000..d0d6a6245 --- /dev/null +++ b/ext/spl/tests/bug62672.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #62672 (Error on serialize of ArrayObject) +--FILE-- +<?php + +class ObjA +{ + private $_varA; + + public function __construct(Iterator $source) + { + $this->_varA = $source; + } +} + +class ObjB extends ObjA +{ + private $_varB; + + public function __construct(ArrayObject $keys) + { + $this->_varB = $keys; + parent::__construct($keys->getIterator()); + } +} + +$obj = new ObjB(new ArrayObject()); + +var_dump($obj == unserialize(serialize($obj))); +--EXPECTF-- +bool(true) diff --git a/ext/sqlite3/libsqlite/sqlite3.c b/ext/sqlite3/libsqlite/sqlite3.c index 784be5134..ccd12771e 100644 --- a/ext/sqlite3/libsqlite/sqlite3.c +++ b/ext/sqlite3/libsqlite/sqlite3.c @@ -11864,7 +11864,7 @@ SQLITE_PRIVATE int sqlite3MemdebugNoType(void*,u8); ** ************************************************************************* ** -** This file contains definitions of global variables and contants. +** This file contains definitions of global variables and constants. */ /* An array to map all upper-case characters into their corresponding @@ -16130,7 +16130,7 @@ SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){ ** 1. All memory allocations sizes are rounded up to a power of 2. ** ** 2. If two adjacent free blocks are the halves of a larger block, -** then the two blocks are coalesed into the single larger block. +** then the two blocks are coalesced into the single larger block. ** ** 3. New memory is allocated from the first available free block. ** @@ -20926,7 +20926,7 @@ do_atof_calc: /* store the result */ *pResult = result; - /* return true if number and no extra non-whitespace chracters after */ + /* return true if number and no extra non-whitespace characters after */ return z>=zEnd && nDigits>0 && eValid; #else return !sqlite3Atoi64(z, pResult, length, enc); @@ -30074,7 +30074,7 @@ static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){ ** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will ** force proxy locking to be used for every database file opened, and 0 ** will force automatic proxy locking to be disabled for all database -** files (explicity calling the SQLITE_SET_LOCKPROXYFILE pragma or +** files (explicitly calling the SQLITE_SET_LOCKPROXYFILE pragma or ** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING). */ @@ -69899,7 +69899,7 @@ SQLITE_PRIVATE int sqlite3MemJournalSize(void){ /* ** Walk an expression tree. Invoke the callback once for each node -** of the expression, while decending. (In other words, the callback +** of the expression, while descending. (In other words, the callback ** is invoked before visiting children.) ** ** The return value from the callback should be one of the WRC_* @@ -70936,7 +70936,7 @@ static int resolveOrderGroupBy( } /* -** Resolve names in the SELECT statement p and all of its descendents. +** Resolve names in the SELECT statement p and all of its descendants. */ static int resolveSelectStep(Walker *pWalker, Select *p){ NameContext *pOuterNC; /* Context that contains this SELECT */ @@ -71244,7 +71244,7 @@ SQLITE_PRIVATE void sqlite3ResolveSelectNames( ** affinity of that column is returned. Otherwise, 0x00 is returned, ** indicating no affinity for the expression. ** -** i.e. the WHERE clause expresssions in the following statements all +** i.e. the WHERE clause expressions in the following statements all ** have an affinity: ** ** CREATE TABLE t1(a); @@ -74260,13 +74260,13 @@ static int evalConstExpr(Walker *pWalker, Expr *pExpr){ /* ** Preevaluate constant subexpressions within pExpr and store the -** results in registers. Modify pExpr so that the constant subexpresions +** results in registers. Modify pExpr so that the constant subexpressions ** are TK_REGISTER opcodes that refer to the precomputed values. ** ** This routine is a no-op if the jump to the cookie-check code has ** already occur. Since the cookie-check jump is generated prior to ** any other serious processing, this check ensures that there is no -** way to accidently bypass the constant initializations. +** way to accidentally bypass the constant initializations. ** ** This routine is also a no-op if the SQLITE_FactorOutConst optimization ** is disabled via the sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS) @@ -75132,7 +75132,7 @@ static void renameParentFunc( ** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER ** statement. The second is a table name. The table name in the CREATE ** TRIGGER statement is replaced with the third argument and the result -** returned. This is analagous to renameTableFunc() above, except for CREATE +** returned. This is analogous to renameTableFunc() above, except for CREATE ** TRIGGER, not CREATE INDEX and CREATE TABLE. */ static void renameTriggerFunc( @@ -86752,7 +86752,7 @@ static int xferOptimization( } #endif #ifndef SQLITE_OMIT_FOREIGN_KEY - /* Disallow the transfer optimization if the destination table constains + /* Disallow the transfer optimization if the destination table constrains ** any foreign key constraints. This is more restrictive than necessary. ** But the main beneficiary of the transfer optimization is the VACUUM ** command, and the VACUUM command disables foreign key constraints. So @@ -93175,7 +93175,7 @@ static int flattenSubquery( pSubSrc = pSub->pSrc; assert( pSubSrc ); /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants, - ** not arbitrary expresssions, we allowed some combining of LIMIT and OFFSET + ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET ** because they could be computed at compile-time. But when LIMIT and OFFSET ** became arbitrary expressions, we were forced to add restrictions (13) ** and (14). */ @@ -94472,7 +94472,7 @@ SQLITE_PRIVATE int sqlite3Select( */ if( pGroupBy ){ KeyInfo *pKeyInfo; /* Keying information for the group by clause */ - int j1; /* A-vs-B comparision jump */ + int j1; /* A-vs-B comparison jump */ int addrOutputRow; /* Start of subroutine that outputs a result row */ int regOutputRow; /* Return address register for output subroutine */ int addrSetAbort; /* Set the abort flag and return */ @@ -118508,7 +118508,7 @@ static int star_oh(const char *z){ /* ** If the word ends with zFrom and xCond() is true for the stem -** of the word that preceds the zFrom ending, then change the +** of the word that precede the zFrom ending, then change the ** ending to zTo. ** ** The input word *pz and zFrom are both in reverse order. zTo @@ -127688,7 +127688,7 @@ SQLITE_API int sqlite3_extension_init( ** * Implementations of the SQL scalar upper() and lower() functions ** for case mapping. ** -** * Integration of ICU and SQLite collation seqences. +** * Integration of ICU and SQLite collation sequences. ** ** * An implementation of the LIKE operator that uses ICU to ** provide case-independent matching. diff --git a/ext/sqlite3/php_sqlite3_structs.h b/ext/sqlite3/php_sqlite3_structs.h index 0e813b6df..6c65e02ee 100644 --- a/ext/sqlite3/php_sqlite3_structs.h +++ b/ext/sqlite3/php_sqlite3_structs.h @@ -23,7 +23,7 @@ #include <sqlite3.h> -/* for backwards compatability reasons */ +/* for backwards compatibility reasons */ #ifndef SQLITE_OPEN_READONLY #define SQLITE_OPEN_READONLY 0x00000001 #endif diff --git a/ext/standard/array.c b/ext/standard/array.c index 9bfb0887a..4f5209e2f 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -352,7 +352,7 @@ PHP_FUNCTION(count) /* Numbers are always smaller than strings int this function as it * anyway doesn't make much sense to compare two different data types. - * This keeps it consistant and simple. + * This keeps it consistent and simple. * * This is not correct any more, depends on what compare_func is set to. */ @@ -1041,7 +1041,7 @@ PHP_FUNCTION(max) static int php_array_walk(HashTable *target_hash, zval *userdata, int recursive TSRMLS_DC) /* {{{ */ { zval **args[3], /* Arguments to userland function */ - *retval_ptr, /* Return value - unused */ + *retval_ptr = NULL, /* Return value - unused */ *key=NULL; /* Entry key */ /* Set up known arguments */ @@ -2911,7 +2911,7 @@ static int zval_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */ static int zval_user_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */ { zval **args[2]; - zval *retval_ptr; + zval *retval_ptr = NULL; args[0] = (zval **) a; args[1] = (zval **) b; diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index fba423b19..2af2209f2 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -358,7 +358,29 @@ else AC_MSG_RESULT(no) fi -if test "$PHP_SAPI" = "cgi" || test "$PHP_SAPI" = "cli" || test "$PHP_SAPI" = "embed"; then +PHP_ENABLE_CHROOT_FUNC=no +case "$PHP_SAPI" in + embed) + PHP_ENABLE_CHROOT_FUNC=yes + ;; + + none) + for PROG in $PHP_BINARIES; do + case "$PROG" in + cgi|cli) + PHP_ENABLE_CHROOT_FUNC=yes + ;; + + *) + PHP_ENABLE_CHROOT_FUNC=no + break + ;; + esac + done + ;; +esac + +if test "$PHP_ENABLE_CHROOT_FUNC" = "yes"; then AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function]) fi diff --git a/ext/standard/image.c b/ext/standard/image.c index b3dade4a7..bd80f11de 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -112,7 +112,7 @@ static struct gfxinfo *php_handle_gif (php_stream * stream TSRMLS_DC) result->width = (unsigned int)dim[0] | (((unsigned int)dim[1])<<8); result->height = (unsigned int)dim[2] | (((unsigned int)dim[3])<<8); result->bits = dim[4]&0x80 ? ((((unsigned int)dim[4])&0x07) + 1) : 0; - result->channels = 3; /* allways */ + result->channels = 3; /* always */ return result; } diff --git a/ext/standard/info.c b/ext/standard/info.c index e8ba90807..32ef94e59 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -117,7 +117,11 @@ static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC zend_hash_internal_pointer_reset_ex(ht, &pos); while (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING) { - php_info_print(key); + if (!sapi_module.phpinfo_as_text) { + php_info_print_html_esc(key, len-1); + } else { + php_info_print(key); + } zend_hash_move_forward_ex(ht, &pos); if (zend_hash_get_current_key_ex(ht, &key, &len, NULL, 0, &pos) == HASH_KEY_IS_STRING) { php_info_print(", "); diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 4c243f778..9499981f2 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -328,7 +328,7 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char sendmail = popen_ex(sendmail_cmd, "wb", NULL, NULL TSRMLS_CC); #else /* Since popen() doesn't indicate if the internal fork() doesn't work - * (e.g. the shell can't be executed) we explicitely set it to 0 to be + * (e.g. the shell can't be executed) we explicitly set it to 0 to be * sure we don't catch any older errno value. */ errno = 0; sendmail = popen(sendmail_cmd, "w"); diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 672c06522..6e9489318 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -69,7 +69,7 @@ char machine_little_endian; /* Mapping of byte from char (8bit) to long for machine endian */ static int byte_map[1]; -/* Mappings of bytes from int (machine dependant) to int for machine endian */ +/* Mappings of bytes from int (machine dependent) to int for machine endian */ static int int_map[sizeof(int)]; /* Mappings of bytes from shorts (16bit) for all endian environments */ diff --git a/ext/standard/string.c b/ext/standard/string.c index f3f78100b..6a67efbd7 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -280,6 +280,7 @@ PHP_FUNCTION(hex2bin) result = php_hex2bin((unsigned char *)data, datalen, &newlen); if (!result) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input string must be hexadecimal string"); RETURN_FALSE; } @@ -1581,7 +1582,7 @@ PHP_FUNCTION(pathinfo) const char *p; int idx; - /* Have we alrady looked up the basename? */ + /* Have we already looked up the basename? */ if (!have_basename && !ret) { php_basename(path, path_len, NULL, 0, &ret, &ret_len TSRMLS_CC); } diff --git a/ext/standard/tests/array/array_column_basic.phpt b/ext/standard/tests/array/array_column_basic.phpt index 7c30cdfd1..418f37387 100644 --- a/ext/standard/tests/array/array_column_basic.phpt +++ b/ext/standard/tests/array/array_column_basic.phpt @@ -178,7 +178,7 @@ array(3) { *** Testing multiple data types *** array(8) { [0]=> - object(stdClass)#1 (0) { + object(stdClass)#%d (0) { } [1]=> float(34.2345) @@ -197,7 +197,7 @@ array(8) { } array(8) { [1]=> - object(stdClass)#1 (0) { + object(stdClass)#%d (0) { } [2]=> float(34.2345) diff --git a/ext/standard/tests/array/array_key_exists_variation2.phpt b/ext/standard/tests/array/array_key_exists_variation2.phpt index a6e9cd2bb..69a1f0a6d 100644 --- a/ext/standard/tests/array/array_key_exists_variation2.phpt +++ b/ext/standard/tests/array/array_key_exists_variation2.phpt @@ -1,5 +1,5 @@ --TEST-- -Test array_key_exists() function : usage variations - Pass differnt data types to $search arg +Test array_key_exists() function : usage variations - Pass different data types to $search arg --FILE-- <?php /* Prototype : bool array_key_exists(mixed $key, array $search) diff --git a/ext/standard/tests/array/array_search_variation4.phpt b/ext/standard/tests/array/array_search_variation4.phpt index 04f3b9138..c247879cc 100644 --- a/ext/standard/tests/array/array_search_variation4.phpt +++ b/ext/standard/tests/array/array_search_variation4.phpt @@ -16,7 +16,7 @@ $file_handle = fopen(__FILE__, "r"); //directory type resource $dir_handle = opendir( dirname(__FILE__) ); -//store resources in array for comparision. +//store resources in array for comparison. $resources = array($file_handle, $dir_handle); // search for resouce type in the resource array diff --git a/ext/standard/tests/array/array_values_variation7.phpt b/ext/standard/tests/array/array_values_variation7.phpt index b71306456..660809357 100644 --- a/ext/standard/tests/array/array_values_variation7.phpt +++ b/ext/standard/tests/array/array_values_variation7.phpt @@ -9,7 +9,7 @@ Test array_values() function : usage variations - Internal order check /* * Check that array_values is re-assigning keys according to the internal order of the array, - * and is not dependant on the \$input argument's keys + * and is not dependent on the \$input argument's keys */ echo "*** Testing array_values() : usage variations ***\n"; diff --git a/ext/standard/tests/array/array_walk_closure.phpt b/ext/standard/tests/array/array_walk_closure.phpt new file mode 100644 index 000000000..4e22bb894 --- /dev/null +++ b/ext/standard/tests/array/array_walk_closure.phpt @@ -0,0 +1,251 @@ +--TEST-- +array_walk() closure tests +--FILE-- +<?php + +var_dump(array_walk()); + +$ar = false; +var_dump(array_walk($ar, $ar)); + +$ar = NULL; +var_dump(array_walk($ar, $ar)); + +$ar = ["one" => 1, "two"=>2, "three" => 3]; +var_dump(array_walk($ar, function(){ var_dump(func_get_args());})); + +echo "\nclosure with array\n"; +$ar = ["one" => 1, "two"=>2, "three" => 3]; +$user_data = ["sum" => 42]; +$func = function($value, $key, &$udata) { + var_dump($udata); + $udata["sum"] += $value; +}; + +var_dump(array_walk($ar, $func, $user_data)); +echo "End result:"; +var_dump($user_data["sum"]); + +echo "\nclosure with use\n"; +$ar = ["one" => 1, "two"=>2, "three" => 3]; +$user_data = ["sum" => 42]; +$func = function($value, $key) use (&$user_data) { + var_dump($user_data); + $user_data["sum"] += $value; +}; + +var_dump(array_walk($ar, $func, $user_data)); +echo "End result:"; +var_dump($user_data["sum"]); + + +echo "\nclosure with object\n"; +$ar = ["one" => 1, "two"=>2, "three" => 3]; +$user_data = (object)["sum" => 42]; +$func = function($value, $key, &$udata) { + var_dump($udata); + $udata->sum += $value; +}; + +var_dump(array_walk($ar, $func, $user_data)); +echo "End result:"; +var_dump($user_data->sum); + + + +echo "\nfunction with object\n"; +function sum_it_up_object($value, $key, $udata) +{ + var_dump($udata); + $udata->sum += $value; +} + +$ar = ["one" => 1, "two"=>2, "three" => 3]; +$user_data = (object)["sum" => 42]; + +var_dump(array_walk($ar, "sum_it_up_object", $user_data)); +echo "End result:"; +var_dump($user_data->sum); + + +echo "\nfunction with array\n"; +function sum_it_up_array($value, $key, $udata) +{ + var_dump($udata); + $udata['sum'] += $value; +} + +$ar = ["one" => 1, "two"=>2, "three" => 3]; +$user_data = ["sum" => 42]; + +var_dump(array_walk($ar, "sum_it_up_array", $user_data)); +echo "End result:"; +var_dump($user_data['sum']); + +echo "\nclosure and exception\n"; +$ar = ["one" => 1, "two"=>2, "three" => 3]; +try { + var_dump(array_walk($ar, function($v, $k) { if ($v == 2) throw new Exception; } )); +} catch (Exception $e) { + var_dump($e->getTrace()); +} + + +echo "Done\n"; +?> +--EXPECTF-- +Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, boolean given in %s on line %d +NULL + +Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d +NULL +array(2) { + [0]=> + int(1) + [1]=> + string(3) "one" +} +array(2) { + [0]=> + int(2) + [1]=> + string(3) "two" +} +array(2) { + [0]=> + int(3) + [1]=> + string(5) "three" +} +bool(true) + +closure with array +array(1) { + ["sum"]=> + int(42) +} +array(1) { + ["sum"]=> + int(43) +} +array(1) { + ["sum"]=> + int(45) +} +bool(true) +End result:int(42) + +closure with use +array(1) { + ["sum"]=> + int(42) +} +array(1) { + ["sum"]=> + int(43) +} +array(1) { + ["sum"]=> + int(45) +} +bool(true) +End result:int(48) + +closure with object +object(stdClass)#1 (1) { + ["sum"]=> + int(42) +} +object(stdClass)#1 (1) { + ["sum"]=> + int(43) +} +object(stdClass)#1 (1) { + ["sum"]=> + int(45) +} +bool(true) +End result:int(48) + +function with object +object(stdClass)#2 (1) { + ["sum"]=> + int(42) +} +object(stdClass)#2 (1) { + ["sum"]=> + int(43) +} +object(stdClass)#2 (1) { + ["sum"]=> + int(45) +} +bool(true) +End result:int(48) + +function with array +array(1) { + ["sum"]=> + int(42) +} +array(1) { + ["sum"]=> + int(42) +} +array(1) { + ["sum"]=> + int(42) +} +bool(true) +End result:int(42) + +closure and exception +array(2) { + [0]=> + array(2) { + ["function"]=> + string(9) "{closure}" + ["args"]=> + array(2) { + [0]=> + int(2) + [1]=> + string(3) "two" + } + } + [1]=> + array(4) { + ["file"]=> + string(%d) "%s" + ["line"]=> + int(%d) + ["function"]=> + string(10) "array_walk" + ["args"]=> + array(2) { + [0]=> + &array(3) { + ["one"]=> + int(1) + ["two"]=> + int(2) + ["three"]=> + int(3) + } + [1]=> + object(Closure)#2 (1) { + ["parameter"]=> + array(2) { + ["$v"]=> + string(10) "<required>" + ["$k"]=> + string(10) "<required>" + } + } + } + } +} +Done diff --git a/ext/standard/tests/array/bug34066.phpt b/ext/standard/tests/array/bug34066.phpt index 31f6b4c1d..023f4176f 100644 --- a/ext/standard/tests/array/bug34066.phpt +++ b/ext/standard/tests/array/bug34066.phpt @@ -123,7 +123,7 @@ Bug #34066 (recursive array_walk causes segfault) "ProceedKeyArticle" => "01", "ActionKey" => "00", "ContactCommissionArticle"=> "0,00", - "QuantDependantPriceKey"=> "", + "QuantdependentPriceKey"=> "", "Quant" => "1", "QuantUnit" => "", "Meas" => array( @@ -584,7 +584,7 @@ gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) /Docs/Doc/DocItems/DocItem/ContactCommissionArticle=0,00 gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) -/Docs/Doc/DocItems/DocItem/QuantDependantPriceKey +/Docs/Doc/DocItems/DocItem/QuantdependentPriceKey gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) end gen_xml(prefix=/Docs/Doc/DocItems/DocItem/) /Docs/Doc/DocItems/DocItem/Quant=1 diff --git a/ext/standard/tests/array/bug34066_1.phpt b/ext/standard/tests/array/bug34066_1.phpt index edc16efd0..6d0f7f84e 100644 --- a/ext/standard/tests/array/bug34066_1.phpt +++ b/ext/standard/tests/array/bug34066_1.phpt @@ -123,7 +123,7 @@ Bug #34066 (recursive array_walk causes segfault) "ProceedKeyArticle" => "01", "ActionKey" => "00", "ContactCommissionArticle"=> "0,00", - "QuantDependantPriceKey"=> "", + "QuantdependentPriceKey"=> "", "Quant" => "1", "QuantUnit" => "", "Meas" => array( @@ -543,7 +543,7 @@ gen_xml(prefix=/Docs/) /Docs/ContactCommissionArticle=0,00 gen_xml(prefix=/Docs/) end gen_xml(prefix=/Docs/) -/Docs/QuantDependantPriceKey +/Docs/QuantdependentPriceKey gen_xml(prefix=/Docs/) end gen_xml(prefix=/Docs/) /Docs/Quant=1 diff --git a/ext/standard/tests/array/in_array_variation4.phpt b/ext/standard/tests/array/in_array_variation4.phpt index b88a5a2d6..a27bb196b 100644 --- a/ext/standard/tests/array/in_array_variation4.phpt +++ b/ext/standard/tests/array/in_array_variation4.phpt @@ -19,7 +19,7 @@ $file_handle = fopen(__FILE__, "r"); //directory type resource $dir_handle = opendir( dirname(__FILE__) ); -//store resources in array for comparision. +//store resources in array for comparison. $resources = array($file_handle, $dir_handle); // search for resouce type in the resource array diff --git a/ext/standard/tests/array/uasort_object2.phpt b/ext/standard/tests/array/uasort_object2.phpt index cd32d8d94..889db9886 100644 --- a/ext/standard/tests/array/uasort_object2.phpt +++ b/ext/standard/tests/array/uasort_object2.phpt @@ -8,7 +8,7 @@ Test uasort() function : object functionality - sort diff. objects * /* - * This testcase tests uasort() functionality with differnt objects + * This testcase tests uasort() functionality with different objects * Objects of different classes: * simple class, * child class, diff --git a/ext/standard/tests/array/uasort_variation10.phpt b/ext/standard/tests/array/uasort_variation10.phpt index 809cb78f5..e0c5e72f7 100644 --- a/ext/standard/tests/array/uasort_variation10.phpt +++ b/ext/standard/tests/array/uasort_variation10.phpt @@ -11,7 +11,7 @@ Test uasort() function : usage variations - sort array with reference variables * Testing uasort() with 'array_arg' containing different reference variables */ -// comparision function +// comparison function /* Prototype : int cmp_function(mixed $value1, mixed $value2) * Parameters : $value1 and $value2 - values to be compared * Return value : 0 - if both values are same diff --git a/ext/standard/tests/array/uasort_variation4.phpt b/ext/standard/tests/array/uasort_variation4.phpt index c2844bfd2..0ed797fb8 100644 --- a/ext/standard/tests/array/uasort_variation4.phpt +++ b/ext/standard/tests/array/uasort_variation4.phpt @@ -12,7 +12,7 @@ Test uasort() function : usage variations - sort different numeric values * integer, octal, hexadecimal & float */ -// comparision function +// comparison function /* Prototype : int cmp_function(mixed $value1, mixed $value2) * Parameters : $value1 and $value2 - values to be compared * Return value : 0 - if both values are same diff --git a/ext/standard/tests/file/bug41874.phpt b/ext/standard/tests/file/bug41874.phpt index 827f486d4..8cc1ce2e6 100644 --- a/ext/standard/tests/file/bug41874.phpt +++ b/ext/standard/tests/file/bug41874.phpt @@ -6,9 +6,9 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test'); ?> --FILE-- <?php -$result = exec('cd 1:\non_existant; dir nonexistant'); +$result = exec('cd 1:\non_existent; dir nonexistent'); echo "$result"; -system('cd 1:\non_existant; dir nonexistant'); +system('cd 1:\non_existent; dir nonexistent'); ?> --EXPECT-- The system cannot find the drive specified. diff --git a/ext/standard/tests/file/bug41874_2.phpt b/ext/standard/tests/file/bug41874_2.phpt index 5d7b7cad8..bf76a749f 100644 --- a/ext/standard/tests/file/bug41874_2.phpt +++ b/ext/standard/tests/file/bug41874_2.phpt @@ -10,7 +10,7 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) { ?> --FILE-- <?php -$result = exec('cd 1:\\non_existant; dir nonexistant'); +$result = exec('cd 1:\\non_existent; dir nonexistent'); echo "$result"; ?> --EXPECT-- diff --git a/ext/standard/tests/file/bug41874_3.phpt b/ext/standard/tests/file/bug41874_3.phpt index 4d7b139ad..05095c6f1 100644 --- a/ext/standard/tests/file/bug41874_3.phpt +++ b/ext/standard/tests/file/bug41874_3.phpt @@ -10,7 +10,7 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) { ?> --FILE-- <?php -system('cd 1:\\non_existant; dir nonexistant'); +system('cd 1:\\non_existent; dir nonexistent'); ?> --EXPECT-- The system cannot find the drive specified.
\ No newline at end of file diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc index c0f86e7c3..b3cd99e1c 100644 --- a/ext/standard/tests/file/file.inc +++ b/ext/standard/tests/file/file.inc @@ -575,13 +575,13 @@ Description: Compares two stat values, stat value should be obtained by stat/lstat $stat1 = first stat array $stat2 = second stat array - $op = type of the comparision to be perform between elements of stat1 and stat2 + $op = type of the comparison to be perform between elements of stat1 and stat2 "!=" compare for not equal "==" compare for equality ">" if each element of stat1 is > than stat2 "<" if each element of stat1 is < than stat2 $fields = contains the key of the elements that needs to be compared. - type of the comparision is based on $op argument value + type of the comparison is based on $op argument value $flag = specify true to dump the stat1 and stat2 */ diff --git a/ext/standard/tests/file/lchown_error.phpt b/ext/standard/tests/file/lchown_error.phpt index 979959e28..bacbd93c8 100644 --- a/ext/standard/tests/file/lchown_error.phpt +++ b/ext/standard/tests/file/lchown_error.phpt @@ -36,7 +36,7 @@ var_dump( lchown( $filename ) ); // More than expected arguments var_dump( lchown( $filename, $uid, 'foobar' ) ); -// Non-existant filename +// Non-existent filename var_dump( lchown( 'foobar_lchown.txt', $uid ) ); // Wrong argument types diff --git a/ext/standard/tests/file/symlink_to_symlink.phpt b/ext/standard/tests/file/symlink_to_symlink.phpt index b7554f9bd..8b7ff65cf 100644 --- a/ext/standard/tests/file/symlink_to_symlink.phpt +++ b/ext/standard/tests/file/symlink_to_symlink.phpt @@ -19,8 +19,8 @@ symlink(basename($prefix . "_file"), $prefix . "_link1"); symlink(basename($prefix . "_link1"), $prefix . "_link2"); // symlink to a non-existent path -@unlink($prefix . "_nonexistant"); -symlink(basename($prefix . "_nonexistant"), $prefix . "_link3"); +@unlink($prefix . "_nonexistent"); +symlink(basename($prefix . "_nonexistent"), $prefix . "_link3"); // symlink to a regular file using an absolute path symlink($prefix . "_file", $prefix . "_link4"); @@ -45,6 +45,6 @@ unlink($prefix . "_file"); --EXPECTF-- %unicode|string%(%d) "symlink_to_symlink.php_file" %unicode|string%(%d) "symlink_to_symlink.php_link1" -%unicode|string%(%d) "symlink_to_symlink.php_nonexistant" +%unicode|string%(%d) "symlink_to_symlink.php_nonexistent" %unicode|string%(%d) "%s/symlink_to_symlink.php_file" %unicode|string%(%d) "%s/symlink_to_symlink.php_link4" diff --git a/ext/standard/tests/file/userstreams.phpt b/ext/standard/tests/file/userstreams.phpt index b5a9707e9..d39898bbe 100644 --- a/ext/standard/tests/file/userstreams.phpt +++ b/ext/standard/tests/file/userstreams.phpt @@ -158,7 +158,7 @@ class mystream } if (@stream_wrapper_register("bogus", "class_not_exist")) { - die("Registered a non-existant class!!!???"); + die("Registered a non-existent class!!!???"); } echo "Not Registered\n"; diff --git a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt index e242d45dc..c53b5153f 100644 --- a/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt +++ b/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt @@ -1,5 +1,12 @@ --TEST-- dl() filename length checks (CVE-2007-4887) +--SKIPIF-- +<?php +$enabled_sapi = array('cgi-fcgi', 'cli', 'embed', 'fpm'); +if (!in_array(php_sapi_name(), $enabled_sapi)) { + die('skip dl() is not enabled for ' . php_sapi_name()); +} +?> --INI-- enable_dl=1 --FILE-- diff --git a/ext/standard/tests/mail/ezmlm_hash_variation1.phpt b/ext/standard/tests/mail/ezmlm_hash_variation1.phpt index aa1e521e9..58957c84a 100644 --- a/ext/standard/tests/mail/ezmlm_hash_variation1.phpt +++ b/ext/standard/tests/mail/ezmlm_hash_variation1.phpt @@ -24,8 +24,8 @@ class sample { //getting the resource $file_handle = fopen(__FILE__, "r"); -// array with different values for $delimeter -$delimeters = array ( +// array with different values for $delimiter +$delimiters = array ( // integer values 0, @@ -68,13 +68,13 @@ $delimeters = array ( @$unset_var ); -// loop through with each element of the $delimeters array to test explode() function +// loop through with each element of the $delimiters array to test explode() function $count = 1; $string = "piece1 piece2 piece3 piece4 piece5 piece6"; $limit = 5; -foreach($delimeters as $delimeter) { +foreach($delimiters as $delimiter) { echo "-- Iteration $count --\n"; - var_dump( explode($delimeter, $string, $limit) ); + var_dump( explode($delimiter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/strings/bug38322.phpt b/ext/standard/tests/strings/bug38322.phpt index 37f5a93f6..79f66f1fa 100644 --- a/ext/standard/tests/strings/bug38322.phpt +++ b/ext/standard/tests/strings/bug38322.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #38322 (reading past array in sscanf() leads to segfault/arbitary code execution) +Bug #38322 (reading past array in sscanf() leads to segfault/arbitrary code execution) --FILE-- <?php diff --git a/ext/standard/tests/strings/bug47322.phpt b/ext/standard/tests/strings/bug47322.phpt index e04b230ba..1fedc2937 100644 --- a/ext/standard/tests/strings/bug47322.phpt +++ b/ext/standard/tests/strings/bug47322.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #47322 (sscanf %d does't work) +Bug #47322 (sscanf %d doesn't work) --FILE-- <?php diff --git a/ext/standard/tests/strings/explode_error.phpt b/ext/standard/tests/strings/explode_error.phpt index f7342e7ad..e88b1b0c6 100644 --- a/ext/standard/tests/strings/explode_error.phpt +++ b/ext/standard/tests/strings/explode_error.phpt @@ -14,11 +14,11 @@ echo "\n-- Testing explode() function with no arguments --\n"; var_dump( explode() ); echo "\n-- Testing explode() function with more than expected no. of arguments --\n"; -$delimeter = " "; +$delimiter = " "; $string = "piece1 piece2 piece3 piece4 piece5 piece6"; $limit = 5; $extra_arg = 10; -var_dump( explode($delimeter, $string, $limit, $extra_arg) ); +var_dump( explode($delimiter, $string, $limit, $extra_arg) ); ?> ===Done=== diff --git a/ext/standard/tests/strings/explode_variation1.phpt b/ext/standard/tests/strings/explode_variation1.phpt index 9c9ce1169..f16f69bec 100644 --- a/ext/standard/tests/strings/explode_variation1.phpt +++ b/ext/standard/tests/strings/explode_variation1.phpt @@ -24,8 +24,8 @@ class sample { //getting the resource $file_handle = fopen(__FILE__, "r"); -// array with different values for $delimeter -$delimeters = array ( +// array with different values for $delimiter +$delimiters = array ( // integer values /*1*/ 0, @@ -68,13 +68,13 @@ $delimeters = array ( /*22*/ @$unset_var ); -// loop through with each element of the $delimeters array to test explode() function +// loop through with each element of the $delimiters array to test explode() function $count = 1; $string = "piece1 piece2 piece3 piece4 piece5 piece6"; $limit = 5; -foreach($delimeters as $delimeter) { +foreach($delimiters as $delimiter) { echo "-- Iteration $count --\n"; - var_dump( explode($delimeter, $string, $limit) ); + var_dump( explode($delimiter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/strings/explode_variation2.phpt b/ext/standard/tests/strings/explode_variation2.phpt index 9e1f72c5a..4de4637ac 100644 --- a/ext/standard/tests/strings/explode_variation2.phpt +++ b/ext/standard/tests/strings/explode_variation2.phpt @@ -70,11 +70,11 @@ $strings = array ( // loop through with each element of the $strings array to test explode() function $count = 1; -$delimeter = " "; +$delimiter = " "; $limit = 5; foreach($strings as $string) { echo "-- Iteration $count --\n"; - var_dump( explode($delimeter, $string, $limit) ); + var_dump( explode($delimiter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/strings/explode_variation3.phpt b/ext/standard/tests/strings/explode_variation3.phpt index 54d5222ca..2e8789310 100644 --- a/ext/standard/tests/strings/explode_variation3.phpt +++ b/ext/standard/tests/strings/explode_variation3.phpt @@ -24,7 +24,7 @@ class sample { //getting the resource $file_handle = fopen(__FILE__, "r"); -// array with different values for $delimeter +// array with different values for $delimiter $limits = array ( // integer values @@ -70,11 +70,11 @@ $limits = array ( // loop through with each element of the $limits array to test explode() function $count = 1; -$delimeter = " "; +$delimiter = " "; $string = "piece1 piece2 piece3 piece4 piece5 piece6"; foreach($limits as $limit) { echo "-- Iteration $count --\n"; - var_dump( explode($delimeter, $string, $limit) ); + var_dump( explode($delimiter, $string, $limit) ); $count ++; } diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt Binary files differindex 4d3502f18..3997c54b5 100644 --- a/ext/standard/tests/strings/implode1.phpt +++ b/ext/standard/tests/strings/implode1.phpt diff --git a/ext/standard/tests/strings/strrchr_basic.phpt b/ext/standard/tests/strings/strrchr_basic.phpt index 1d4e50efd..b5bfe2d9c 100644 --- a/ext/standard/tests/strings/strrchr_basic.phpt +++ b/ext/standard/tests/strings/strrchr_basic.phpt @@ -34,7 +34,7 @@ var_dump( strrchr("Hello, World", "Hi") ); var_dump( strrchr("Hello, World", "o") ); var_dump( strrchr("Hello, World", "ooo") ); -var_dump( strrchr("Hello, World", "Zzzz") ); //non-existant needle in haystack +var_dump( strrchr("Hello, World", "Zzzz") ); //non-existent needle in haystack echo "*** Done ***"; ?> --EXPECTF-- diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt index 7d3a695d4..fd314cbd9 100644 --- a/ext/standard/tests/strings/substr_replace_error.phpt +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -26,7 +26,7 @@ echo "\n-- Testing substr_replace() function with start and length different typ var_dump(substr_replace($s1, "evening", array(5))); var_dump(substr_replace($s1, "evening", 5, array(8))); -echo "\n-- Testing substr_replace() function with start and length with a different number of elments --\n"; +echo "\n-- Testing substr_replace() function with start and length with a different number of elements --\n"; var_dump(substr_replace($s1, "evening", array(5, 1), array(8))); echo "\n-- Testing substr_replace() function with start and length as arrays but string not--\n"; @@ -58,7 +58,7 @@ string(12) "Good morning" Warning: substr_replace(): 'from' and 'len' should be of same type - numerical or array in %s on line %d string(12) "Good morning" --- Testing substr_replace() function with start and length with a different number of elments -- +-- Testing substr_replace() function with start and length with a different number of elements -- Warning: substr_replace(): 'from' and 'len' should have the same number of elements in %s on line %d string(12) "Good morning" diff --git a/ext/standard/url.c b/ext/standard/url.c index 94f6638d6..190b4665e 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -266,7 +266,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) p = s; } else { /* memrchr is a GNU specific extension - Emulate for wide compatability */ + Emulate for wide compatibility */ for(p = e; *p != ':' && p >= s; p--); } diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index fe7378b9d..3a1f3abeb 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -519,48 +519,61 @@ state_next_arg: }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; - if (yych <= ' ') { + if (yych <= '.') { if (yych <= '\f') { - if (yych <= 0x08) goto yy34; - if (yych <= '\v') goto yy30; - goto yy34; + if (yych <= 0x08) goto yy36; + if (yych <= '\v') goto yy32; + goto yy36; } else { - if (yych <= '\r') goto yy30; - if (yych <= 0x1F) goto yy34; - goto yy30; + if (yych <= '\r') goto yy32; + if (yych == ' ') goto yy32; + goto yy36; } } else { if (yych <= '@') { - if (yych != '>') goto yy34; + if (yych <= '/') goto yy28; + if (yych == '>') goto yy30; + goto yy36; } else { - if (yych <= 'Z') goto yy32; - if (yych <= '`') goto yy34; - if (yych <= 'z') goto yy32; - goto yy34; + if (yych <= 'Z') goto yy34; + if (yych <= '`') goto yy36; + if (yych <= 'z') goto yy34; + goto yy36; } } +yy28: ++YYCURSOR; - { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } + if ((yych = *YYCURSOR) == '>') goto yy39; +yy29: + { passthru(STD_ARGS); goto state_plain_begin; } yy30: ++YYCURSOR; - yych = *YYCURSOR; - goto yy37; yy31: - { passthru(STD_ARGS); goto state_next_arg; } + { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } yy32: ++YYCURSOR; - { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } + yych = *YYCURSOR; + goto yy38; +yy33: + { passthru(STD_ARGS); goto state_next_arg; } yy34: ++YYCURSOR; - { passthru(STD_ARGS); goto state_plain_begin; } + { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } yy36: + yych = *++YYCURSOR; + goto yy29; +yy37: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy37: +yy38: if (yybm[0+yych] & 128) { - goto yy36; + goto yy37; } + goto yy33; +yy39: + ++YYCURSOR; + yych = *YYCURSOR; goto yy31; } @@ -606,28 +619,28 @@ state_arg: }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; - if (yych <= '@') goto yy42; - if (yych <= 'Z') goto yy40; - if (yych <= '`') goto yy42; - if (yych >= '{') goto yy42; -yy40: + if (yych <= '@') goto yy44; + if (yych <= 'Z') goto yy42; + if (yych <= '`') goto yy44; + if (yych >= '{') goto yy44; +yy42: ++YYCURSOR; yych = *YYCURSOR; - goto yy45; -yy41: + goto yy47; +yy43: { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; } -yy42: +yy44: ++YYCURSOR; { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; } -yy44: +yy46: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy45: +yy47: if (yybm[0+yych] & 128) { - goto yy44; + goto yy46; } - goto yy41; + goto yy43; } @@ -672,41 +685,41 @@ state_before_val: }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; - if (yych == ' ') goto yy48; - if (yych == '=') goto yy50; - goto yy52; -yy48: + if (yych == ' ') goto yy50; + if (yych == '=') goto yy52; + goto yy54; +yy50: yych = *(YYMARKER = ++YYCURSOR); - if (yych == ' ') goto yy55; - if (yych == '=') goto yy53; -yy49: + if (yych == ' ') goto yy57; + if (yych == '=') goto yy55; +yy51: { --YYCURSOR; goto state_next_arg_begin; } -yy50: +yy52: ++YYCURSOR; yych = *YYCURSOR; - goto yy54; -yy51: + goto yy56; +yy53: { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; } -yy52: +yy54: yych = *++YYCURSOR; - goto yy49; -yy53: + goto yy51; +yy55: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; -yy54: +yy56: if (yybm[0+yych] & 128) { - goto yy53; + goto yy55; } - goto yy51; -yy55: + goto yy53; +yy57: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yych == ' ') goto yy55; - if (yych == '=') goto yy53; + if (yych == ' ') goto yy57; + if (yych == '=') goto yy55; YYCURSOR = YYMARKER; - goto yy49; + goto yy51; } @@ -717,139 +730,112 @@ state_val: { YYCTYPE yych; static const unsigned char yybm[] = { - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 160, 160, 248, 248, 160, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 160, 248, 56, 248, 248, 248, 248, 200, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 0, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 192, 192, 224, 224, 192, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 192, 224, 64, 224, 224, 224, 224, 128, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 0, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 224, }; - if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; if (yych <= ' ') { if (yych <= '\f') { - if (yych <= 0x08) goto yy63; - if (yych <= '\n') goto yy64; - goto yy63; + if (yych <= 0x08) goto yy65; + if (yych <= '\n') goto yy67; + goto yy65; } else { - if (yych <= '\r') goto yy64; - if (yych <= 0x1F) goto yy63; - goto yy64; + if (yych <= '\r') goto yy67; + if (yych <= 0x1F) goto yy65; + goto yy67; } } else { if (yych <= '&') { - if (yych != '"') goto yy63; + if (yych != '"') goto yy65; } else { - if (yych <= '\'') goto yy62; - if (yych == '>') goto yy64; - goto yy63; + if (yych <= '\'') goto yy64; + if (yych == '>') goto yy67; + goto yy65; } } yych = *(YYMARKER = ++YYCURSOR); - goto yy77; -yy61: - { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } -yy62: - yych = *(YYMARKER = ++YYCURSOR); - goto yy69; + if (yych != '>') goto yy76; yy63: - yych = *++YYCURSOR; - goto yy67; -yy64: - ++YYCURSOR; { passthru(STD_ARGS); goto state_next_arg_begin; } -yy66: +yy64: + yych = *(YYMARKER = ++YYCURSOR); + if (yych == '>') goto yy63; + goto yy71; +yy65: ++YYCURSOR; - if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; + goto yy69; +yy66: + { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } yy67: - if (yybm[0+yych] & 8) { - goto yy66; - } - goto yy61; + yych = *++YYCURSOR; + goto yy63; yy68: - YYMARKER = ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; yy69: - if (yybm[0+yych] & 16) { + if (yybm[0+yych] & 32) { goto yy68; } - if (yych <= '&') goto yy72; - if (yych >= '(') goto yy61; - ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 8) { - goto yy66; - } -yy71: - { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } -yy72: + goto yy66; +yy70: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; - if (yybm[0+yych] & 32) { - goto yy72; - } - if (yych <= '=') goto yy75; -yy74: - YYCURSOR = YYMARKER; - goto yy61; -yy75: - yych = *++YYCURSOR; - goto yy71; -yy76: - YYMARKER = ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); - yych = *YYCURSOR; -yy77: +yy71: if (yybm[0+yych] & 64) { - goto yy76; + goto yy70; } - if (yych <= '!') goto yy80; - if (yych >= '#') goto yy61; + if (yych <= '=') goto yy73; +yy72: + YYCURSOR = YYMARKER; + goto yy63; +yy73: ++YYCURSOR; - if (yybm[0+(yych = *YYCURSOR)] & 8) { - goto yy66; - } -yy79: - { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } -yy80: + { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } +yy75: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = *YYCURSOR; +yy76: if (yybm[0+yych] & 128) { - goto yy80; + goto yy75; } - if (yych >= '>') goto yy74; + if (yych >= '>') goto yy72; ++YYCURSOR; - yych = *YYCURSOR; - goto yy79; + { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } } diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index 760f725e9..f0dee8ebc 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -317,7 +317,7 @@ state_next_arg_begin: state_next_arg: start = YYCURSOR; /*!re2c - ">" { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } + [/]? [>] { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } [ \v\r\t\n]+ { passthru(STD_ARGS); goto state_next_arg; } alpha { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } any { passthru(STD_ARGS); goto state_plain_begin; } @@ -343,7 +343,7 @@ state_val: /*!re2c ["] (any\[">])* ["] { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } ['] (any\['>])* ['] { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } - (any\[ \r\t\n>])+ { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } + (any\[ \r\t\n>'"])+ { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } any { passthru(STD_ARGS); goto state_next_arg_begin; } */ diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index bd4cf1429..ee53d484c 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -1121,7 +1121,7 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) break; case CS_CMD_FAIL: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Command failed, cancelling rest"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Command failed, canceling rest"); ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); fail = 1; break; @@ -1131,7 +1131,7 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) case CS_PARAM_RESULT: case CS_ROW_RESULT: /* Unexpected results, cancel them. */ - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, cancelling current"); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, canceling current"); ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_CURRENT); break; @@ -1141,7 +1141,7 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) break; default: - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, cancelling all"); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, canceling all"); ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); break; } @@ -1696,7 +1696,7 @@ PHP_FUNCTION(sybase_free_result) /* Did we fetch up until the end? */ if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) { - /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cancelling the rest of the results"); */ + /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: canceling the rest of the results"); */ ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); php_sybase_finish_results(result TSRMLS_CC); } diff --git a/ext/sybase_ct/tests/bug26407.phpt b/ext/sybase_ct/tests/bug26407.phpt index 35bf6df7a..27f5f99b9 100644 --- a/ext/sybase_ct/tests/bug26407.phpt +++ b/ext/sybase_ct/tests/bug26407.phpt @@ -80,7 +80,7 @@ bool(true) select "bar" -Notice: sybase_query(): Sybase: Unexpected results, cancelling current in %stest.inc on line %d +Notice: sybase_query(): Sybase: Unexpected results, canceling current in %stest.inc on line %d <<< Return: resource array(1) { [0]=> diff --git a/ext/sybase_ct/tests/bug43578.phpt b/ext/sybase_ct/tests/bug43578.phpt index e840402ed..9f75b9c0e 100644 --- a/ext/sybase_ct/tests/bug43578.phpt +++ b/ext/sybase_ct/tests/bug43578.phpt @@ -23,7 +23,7 @@ Sybase-CT bug #43578 (Incurred fault #6 - if returned textfield ist empty) var_dump(sybase_query('insert into #Resource values (123, NULL)', $db)); var_dump(sybase_query('insert into #Resource values (124, "")', $db)); - // Select non-existant + // Select non-existent var_dump(sybase_select_ex($db, 'select DC_Rights from #Resource where Resource_ID = 122')); // Select null diff --git a/ext/sybase_ct/tests/test_fetch_object.phpt b/ext/sybase_ct/tests/test_fetch_object.phpt index c23658fa3..2d225cd9c 100644 --- a/ext/sybase_ct/tests/test_fetch_object.phpt +++ b/ext/sybase_ct/tests/test_fetch_object.phpt @@ -40,7 +40,7 @@ Sybase-CT sybase_fetch_object // Test with object var_export(fetch_object($db, new article())); echo "\n"; - // Test with non-existant class + // Test with non-existent class var_export(fetch_object($db, '***')); echo "\n"; sybase_close($db); diff --git a/ext/sybase_ct/tests/test_msghandler.phpt b/ext/sybase_ct/tests/test_msghandler.phpt index afe97cbef..3189aaac2 100644 --- a/ext/sybase_ct/tests/test_msghandler.phpt +++ b/ext/sybase_ct/tests/test_msghandler.phpt @@ -13,7 +13,7 @@ Sybase-CT server message handler $db= sybase_connect_ex(); - echo 'Nonexistant: '; sybase_set_messagehandler_ex('function_does_not_exist'); + echo 'Nonexistent: '; sybase_set_messagehandler_ex('function_does_not_exist'); echo 'Static method: '; sybase_set_messagehandler_ex(array('sybase', 'static_handler')); echo 'Instance method: '; sybase_set_messagehandler_ex(array(new sybase(), 'handler')); echo 'Lambda function: '; sybase_set_messagehandler_ex(create_function('', 'return FALSE;')); @@ -25,7 +25,7 @@ Sybase-CT server message handler sybase_close($db); ?> --EXPECTF-- -Nonexistant: +Nonexistent: Warning: sybase_set_message_handler() expects parameter 1 to be a valid callback, function 'function_does_not_exist' not found or invalid function name in %stest.inc on line %d NULL Static method: bool(true) diff --git a/ext/xml/tests/bug65236.phpt b/ext/xml/tests/bug65236.phpt new file mode 100644 index 000000000..67b26d663 --- /dev/null +++ b/ext/xml/tests/bug65236.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #65236 (heap corruption in xml parser) +--SKIPIF-- +<?php +require_once("skipif.inc"); +?> +--FILE-- +<?php +xml_parse_into_struct(xml_parser_create_ns(), str_repeat("<blah>", 1000), $a); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: xml_parse_into_struct(): Maximum depth exceeded - Results truncated in %s on line %d +Done diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 2fea4f8ab..334938ab2 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -428,7 +428,7 @@ static void xml_parser_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) } if (parser->ltags) { int inx; - for (inx = 0; inx < parser->level; inx++) + for (inx = 0; ((inx < parser->level) && (inx < XML_MAXLEVEL)); inx++) efree(parser->ltags[ inx ]); efree(parser->ltags); } @@ -805,45 +805,50 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch } if (parser->data) { - zval *tag, *atr; - int atcnt = 0; + if (parser->level <= XML_MAXLEVEL) { + zval *tag, *atr; + int atcnt = 0; - MAKE_STD_ZVAL(tag); - MAKE_STD_ZVAL(atr); + MAKE_STD_ZVAL(tag); + MAKE_STD_ZVAL(atr); - array_init(tag); - array_init(atr); + array_init(tag); + array_init(atr); - _xml_add_to_info(parser,((char *) tag_name) + parser->toffset); + _xml_add_to_info(parser,((char *) tag_name) + parser->toffset); - add_assoc_string(tag,"tag",((char *) tag_name) + parser->toffset,1); /* cast to avoid gcc-warning */ - add_assoc_string(tag,"type","open",1); - add_assoc_long(tag,"level",parser->level); + add_assoc_string(tag,"tag",((char *) tag_name) + parser->toffset,1); /* cast to avoid gcc-warning */ + add_assoc_string(tag,"type","open",1); + add_assoc_long(tag,"level",parser->level); - parser->ltags[parser->level-1] = estrdup(tag_name); - parser->lastwasopen = 1; + parser->ltags[parser->level-1] = estrdup(tag_name); + parser->lastwasopen = 1; - attributes = (const XML_Char **) attrs; + attributes = (const XML_Char **) attrs; - while (attributes && *attributes) { - att = _xml_decode_tag(parser, attributes[0]); - val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, parser->target_encoding); - - add_assoc_stringl(atr,att,val,val_len,0); + while (attributes && *attributes) { + att = _xml_decode_tag(parser, attributes[0]); + val = xml_utf8_decode(attributes[1], strlen(attributes[1]), &val_len, parser->target_encoding); - atcnt++; - attributes += 2; + add_assoc_stringl(atr,att,val,val_len,0); - efree(att); - } + atcnt++; + attributes += 2; - if (atcnt) { - zend_hash_add(Z_ARRVAL_P(tag),"attributes",sizeof("attributes"),&atr,sizeof(zval*),NULL); - } else { - zval_ptr_dtor(&atr); - } + efree(att); + } + + if (atcnt) { + zend_hash_add(Z_ARRVAL_P(tag),"attributes",sizeof("attributes"),&atr,sizeof(zval*),NULL); + } else { + zval_ptr_dtor(&atr); + } - zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),(void *) &parser->ctag); + zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),(void *) &parser->ctag); + } else if (parser->level == (XML_MAXLEVEL + 1)) { + TSRMLS_FETCH(); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Maximum depth exceeded - Results truncated"); + } } efree(tag_name); @@ -895,7 +900,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name) efree(tag_name); - if (parser->ltags) { + if ((parser->ltags) && (parser->level <= XML_MAXLEVEL)) { efree(parser->ltags[parser->level-1]); } @@ -979,18 +984,23 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) } } - MAKE_STD_ZVAL(tag); - - array_init(tag); - - _xml_add_to_info(parser,parser->ltags[parser->level-1] + parser->toffset); + if (parser->level <= XML_MAXLEVEL) { + MAKE_STD_ZVAL(tag); + + array_init(tag); - add_assoc_string(tag,"tag",parser->ltags[parser->level-1] + parser->toffset,1); - add_assoc_string(tag,"value",decoded_value,0); - add_assoc_string(tag,"type","cdata",1); - add_assoc_long(tag,"level",parser->level); + _xml_add_to_info(parser,parser->ltags[parser->level-1] + parser->toffset); - zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL); + add_assoc_string(tag,"tag",parser->ltags[parser->level-1] + parser->toffset,1); + add_assoc_string(tag,"value",decoded_value,0); + add_assoc_string(tag,"type","cdata",1); + add_assoc_long(tag,"level",parser->level); + + zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),NULL); + } else if (parser->level == (XML_MAXLEVEL + 1)) { + TSRMLS_FETCH(); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Maximum depth exceeded - Results truncated"); + } } } else { efree(decoded_value); diff --git a/ext/xmlwriter/tests/bug41287.phpt b/ext/xmlwriter/tests/bug41287.phpt index 0612b21f1..72b6720f1 100644 --- a/ext/xmlwriter/tests/bug41287.phpt +++ b/ext/xmlwriter/tests/bug41287.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #41287 (Namespace functions don't allow xmlns defintion to be optional) +Bug #41287 (Namespace functions don't allow xmlns definition to be optional) --SKIPIF-- <?php if (!extension_loaded("xmlwriter")) die("skip"); |