From 9b233b7e5ec236774c84dc83b4020b1258762c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 4 Jun 2012 10:18:24 +0200 Subject: [PATCH 1/8] Changed XFAILed collator_get_sort_key.phpt Ressurected and limited to ICU 4.8 in the hope that the sort keys will remain stable in more recent ICU versions. I have only tested with ICU 4.8 so far. --- ext/intl/tests/collator_get_sort_key.phpt | 71 +++++++++++------------ 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/ext/intl/tests/collator_get_sort_key.phpt b/ext/intl/tests/collator_get_sort_key.phpt index 0fedde0fff2..a9c4d713481 100755 --- a/ext/intl/tests/collator_get_sort_key.phpt +++ b/ext/intl/tests/collator_get_sort_key.phpt @@ -2,8 +2,7 @@ collator_get_sort_key() --SKIPIF-- ---XFAIL-- -Sort keys are not fixed, comparing them to fixed strings doesn't work. += 4.8 only'; ?> --FILE-- --EXPECT-- source: abc -key: %29%2B-%01%07%01%07%00 +key: 27292b01070107 source: abd -key: %29%2B%2F%01%07%01%07%00 +key: 27292d01070107 source: aaa -key: %29%29%29%01%07%01%07%00 -source: %D0%B0%D0%B0 -key: _++%01%06%01%06%00 -source: %D0%B0 -key: _+%01%05%01%05%00 +key: 27272701070107 +source: аа +key: 5c0a0a01060106 +source: а +key: 5c0a01050105 source: z -key: %5B%01%05%01%05%00 -source: -key: %01%01%00 -source: -key: %01%01%00 +key: 5901050105 +source: +key: 0101 +source: +key: 0101 source: 3 -key: %26%80%01%05%01%05%00 +key: 1801050105 source: y -key: Y%01%05%01%05%00 +key: 5701050105 source: i -key: 9%01%05%01%05%00 +key: 3701050105 source: k -key: %3D%01%05%01%05%00 -source: %D0%B0%D0%B1%D0%B3 -key: _+%2C0%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B2 -key: _+%2C.%01%07%01%07%00 -source: %D0%B6%D0%B6%D0%B6 -key: _LLL%01%07%01%07%00 -source: %D1%8D%D1%8E%D1%8F -key: %60%05%09%0B%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B3 -key: _+%2C0%01%07%01%07%00 -source: %D0%B0%D0%B1%D0%B2 -key: _+%2C.%01%07%01%07%00 -source: %D0%B6%D0%B6%D0%B6 -key: _LLL%01%07%01%07%00 -source: %D1%8D%D1%8E%D1%8F -key: %60%05%09%0B%01%07%01%07%00 \ No newline at end of file +key: 3b01050105 +source: абг +key: 5c0a161a01070107 +source: абв +key: 5c0a161801070107 +source: жжж +key: 5c3a3a3a01070107 +source: эюя +key: 5d3b3f4501070107 +source: абг +key: 5c0a161a01070107 +source: абв +key: 5c0a161801070107 +source: жжж +key: 5c3a3a3a01070107 +source: эюя +key: 5d3b3f4501070107 \ No newline at end of file From 45b3fa4deea739c8a3bf8778efac2f748a2685bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Tue, 5 Jun 2012 16:47:00 +0200 Subject: [PATCH 2/8] Fixed tests in ext/intl 21 is not a valid value for UNUM_PADDING_POSITION. Changed the test to use 2 instead. Remove ICU 4.2- test. No one cares. --- .../tests/formatter_get_set_attribute.phpt | 10 +- .../tests/formatter_get_set_attribute2.phpt | 194 ------------------ 2 files changed, 5 insertions(+), 199 deletions(-) delete mode 100644 ext/intl/tests/formatter_get_set_attribute2.phpt diff --git a/ext/intl/tests/formatter_get_set_attribute.phpt b/ext/intl/tests/formatter_get_set_attribute.phpt index cb5e4157559..51c7d3658a3 100755 --- a/ext/intl/tests/formatter_get_set_attribute.phpt +++ b/ext/intl/tests/formatter_get_set_attribute.phpt @@ -1,8 +1,8 @@ --TEST-- -numfmt_get/set_attribute() icu < 4.2 +numfmt_get/set_attribute() --SKIPIF-- - + --FILE-- array( NumberFormatter::ROUNDING_MODE, 1, 12345.123456 ), 'ROUNDING_INCREMENT' => array( NumberFormatter::ROUNDING_INCREMENT, (float)2, 12345.123456 ), 'FORMAT_WIDTH' => array( NumberFormatter::FORMAT_WIDTH, 27, 12345.123456 ), - 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 21, 12345.123456 ), + 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 2, 12345.123456 ), 'SECONDARY_GROUPING_SIZE' => array( NumberFormatter::SECONDARY_GROUPING_SIZE, 2, 12345.123456 ), 'SIGNIFICANT_DIGITS_USED' => array( NumberFormatter::SIGNIFICANT_DIGITS_USED, 1, 12345.123456 ), 'MIN_SIGNIFICANT_DIGITS' => array( NumberFormatter::MIN_SIGNIFICANT_DIGITS, 3, 1 ), @@ -159,7 +159,7 @@ Setting attribute: ok New attribute value: 1 ; Format result: '0,012,345.12345' ; Parse result: 12345.12345 Attribute ROUNDING_INCREMENT -Old attribute value: 1.0E-5 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 +Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 Setting attribute: ok New attribute value: 2 ; Format result: '0,012,346.00000' ; Parse result: 12346 @@ -171,7 +171,7 @@ New attribute value: 27 ; Format result: '************0,012,345.12346' ; Parse Attribute PADDING_POSITION Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 Setting attribute: ok -New attribute value: 21 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 +New attribute value: 2 ; Format result: '0,012,345.12346************' ; Parse result: 12345.12346 Attribute SECONDARY_GROUPING_SIZE Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 diff --git a/ext/intl/tests/formatter_get_set_attribute2.phpt b/ext/intl/tests/formatter_get_set_attribute2.phpt deleted file mode 100644 index 7d5fe69dca8..00000000000 --- a/ext/intl/tests/formatter_get_set_attribute2.phpt +++ /dev/null @@ -1,194 +0,0 @@ ---TEST-- -numfmt_get/set_attribute() icu >= 4.8 ---SKIPIF-- - - ---FILE-- - array( attr, value ) - $attributes = array( - 'PARSE_INT_ONLY' => array( NumberFormatter::PARSE_INT_ONLY, 1, 12345.123456 ), - 'GROUPING_USED' => array( NumberFormatter::GROUPING_USED, 0, 12345.123456 ), - 'DECIMAL_ALWAYS_SHOWN' => array( NumberFormatter::DECIMAL_ALWAYS_SHOWN, 1, 12345 ), - 'MAX_INTEGER_DIGITS' => array( NumberFormatter::MAX_INTEGER_DIGITS, 2, 12345.123456 ), - 'MIN_INTEGER_DIGITS' => array( NumberFormatter::MIN_INTEGER_DIGITS, 20, 12345.123456 ), - 'INTEGER_DIGITS' => array( NumberFormatter::INTEGER_DIGITS, 7, 12345.123456 ), - 'MAX_FRACTION_DIGITS' => array( NumberFormatter::MAX_FRACTION_DIGITS, 2, 12345.123456 ), - 'MIN_FRACTION_DIGITS' => array( NumberFormatter::MIN_FRACTION_DIGITS, 20, 12345.123456 ), - 'FRACTION_DIGITS' => array( NumberFormatter::FRACTION_DIGITS, 5, 12345.123456 ), - 'MULTIPLIER' => array( NumberFormatter::MULTIPLIER, 2, 12345.123456 ), - 'GROUPING_SIZE' => array( NumberFormatter::GROUPING_SIZE, 2, 12345.123456 ), - 'ROUNDING_MODE' => array( NumberFormatter::ROUNDING_MODE, 1, 12345.123456 ), - 'ROUNDING_INCREMENT' => array( NumberFormatter::ROUNDING_INCREMENT, (float)2, 12345.123456 ), - 'FORMAT_WIDTH' => array( NumberFormatter::FORMAT_WIDTH, 27, 12345.123456 ), - 'PADDING_POSITION' => array( NumberFormatter::PADDING_POSITION, 21, 12345.123456 ), - 'SECONDARY_GROUPING_SIZE' => array( NumberFormatter::SECONDARY_GROUPING_SIZE, 2, 12345.123456 ), - 'SIGNIFICANT_DIGITS_USED' => array( NumberFormatter::SIGNIFICANT_DIGITS_USED, 1, 12345.123456 ), - 'MIN_SIGNIFICANT_DIGITS' => array( NumberFormatter::MIN_SIGNIFICANT_DIGITS, 3, 1 ), - 'MAX_SIGNIFICANT_DIGITS' => array( NumberFormatter::MAX_SIGNIFICANT_DIGITS, 4, 12345.123456 ), - // 'LENIENT_PARSE' => array( NumberFormatter::LENIENT_PARSE, 2, 12345.123456 ) - ); - - $res_str = ''; - - $fmt = ut_nfmt_create( "en_US", NumberFormatter::DECIMAL ); - - foreach( $attributes as $attr_name => $args ) - { - list( $attr, $new_val, $number ) = $args; - $res_str .= "\nAttribute $attr_name\n"; - - // Get original value of the attribute. - $orig_val = ut_nfmt_get_attribute( $fmt, $attr ); - - // Format the number using the original attribute value. - $rc = ut_nfmt_format( $fmt, $number ); - - $ps = ut_nfmt_parse( $fmt, $rc ); - - $res_str .= sprintf( "Old attribute value: %s ; Format result: %s ; Parse result: %s\n", - dump( $orig_val ), - dump( $rc ), - dump( $ps ) ); - - // Set new attribute value. - $rc = ut_nfmt_set_attribute( $fmt, $attr, $new_val ); - if( $rc ) - $res_str .= "Setting attribute: ok\n"; - else - $res_str .= sprintf( "Setting attribute failed: %s\n", ut_nfmt_get_error_message( $fmt ) ); - - // Format the number using the new value. - $rc = ut_nfmt_format( $fmt, $number ); - - // Get current value of the attribute and check if it equals $new_val. - $attr_val_check = ut_nfmt_get_attribute( $fmt, $attr ); - if( $attr_val_check !== $new_val ) - $res_str .= "ERROR: New $attr_name attribute value has not been set correctly.\n"; - - $ps = ut_nfmt_parse( $fmt, $rc ); - - $res_str .= sprintf( "New attribute value: %s ; Format result: %s ; Parse result: %s\n", - dump( $new_val ), - dump( $rc ), - dump( $ps ) ); - - - // Restore original attribute of the value - if( $attr != NumberFormatter::INTEGER_DIGITS && $attr != NumberFormatter::FRACTION_DIGITS - && $attr != NumberFormatter::FORMAT_WIDTH && $attr != NumberFormatter::SIGNIFICANT_DIGITS_USED ) - ut_nfmt_set_attribute( $fmt, $attr, $orig_val ); - } - - return $res_str; -} - -include_once( 'ut_common.inc' ); - -// Run the test -ut_run(); - -?> ---EXPECT-- -Attribute PARSE_INT_ONLY -Old attribute value: 0 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345 - -Attribute GROUPING_USED -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 0 ; Format result: '12345.123' ; Parse result: 12345.123 - -Attribute DECIMAL_ALWAYS_SHOWN -Old attribute value: 0 ; Format result: '12,345' ; Parse result: 12345 -Setting attribute: ok -New attribute value: 1 ; Format result: '12,345.' ; Parse result: 12345 - -Attribute MAX_INTEGER_DIGITS -Old attribute value: 309 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 2 ; Format result: '45.123' ; Parse result: 45.123 - -Attribute MIN_INTEGER_DIGITS -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 20 ; Format result: '00,000,000,000,000,012,345.123' ; Parse result: 12345.123 - -Attribute INTEGER_DIGITS -Old attribute value: 1 ; Format result: '12,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 7 ; Format result: '0,012,345.123' ; Parse result: 12345.123 - -Attribute MAX_FRACTION_DIGITS -Old attribute value: 3 ; Format result: '0,012,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,012,345.12' ; Parse result: 12345.12 - -Attribute MIN_FRACTION_DIGITS -Old attribute value: 0 ; Format result: '0,012,345.123' ; Parse result: 12345.123 -Setting attribute: ok -New attribute value: 20 ; Format result: '0,012,345.12345600000000000000' ; Parse result: 12345.123456 - -Attribute FRACTION_DIGITS -Old attribute value: 0 ; Format result: '0,012,345.123456' ; Parse result: 12345.123456 -Setting attribute: ok -New attribute value: 5 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 - -Attribute MULTIPLIER -Old attribute value: 1 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,024,690.24691' ; Parse result: 12345.123455 - -Attribute GROUPING_SIZE -Old attribute value: 3 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,01,23,45.12346' ; Parse result: 12345.12346 - -Attribute ROUNDING_MODE -Old attribute value: 4 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 1 ; Format result: '0,012,345.12345' ; Parse result: 12345.12345 - -Attribute ROUNDING_INCREMENT -Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '0,012,346.00000' ; Parse result: 12346 - -Attribute FORMAT_WIDTH -Old attribute value: 0 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 27 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 - -Attribute PADDING_POSITION -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 21 ; Format result: '0,012,345.12346' ; Parse result: 12345.12346 - -Attribute SECONDARY_GROUPING_SIZE -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 2 ; Format result: '************00,12,345.12346' ; Parse result: 12345.12346 - -Attribute SIGNIFICANT_DIGITS_USED -Old attribute value: 0 ; Format result: '************0,012,345.12346' ; Parse result: 12345.12346 -Setting attribute: ok -New attribute value: 1 ; Format result: '*******************12,345.1' ; Parse result: 12345.1 - -Attribute MIN_SIGNIFICANT_DIGITS -Old attribute value: 1 ; Format result: '**************************1' ; Parse result: 1 -Setting attribute: ok -New attribute value: 3 ; Format result: '***********************1.00' ; Parse result: 1 - -Attribute MAX_SIGNIFICANT_DIGITS -Old attribute value: 6 ; Format result: '*******************12,345.1' ; Parse result: 12345.1 -Setting attribute: ok -New attribute value: 4 ; Format result: '*********************12,350' ; Parse result: 12350 From 52d541a3149d4a21e9f45fa80b26c338636f92c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Wed, 6 Jun 2012 11:36:00 +0200 Subject: [PATCH 3/8] Optimization in ext/intl/msgformat Don't transform the string to make it apostrophe friendly in ICU 4.8+ as that it is now the default. --- ext/intl/msgformat/msgformat.c | 2 ++ ext/intl/msgformat/msgformat_attr.c | 2 ++ ext/intl/msgformat/msgformat_class.h | 12 +++++++++--- ext/intl/msgformat/msgformat_data.c | 2 ++ ext/intl/msgformat/msgformat_data.h | 7 +++++-- ext/intl/msgformat/msgformat_format.c | 2 ++ ext/intl/msgformat/msgformat_parse.c | 2 ++ 7 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 84f14de1bdc..0a01204fae9 100755 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -64,9 +64,11 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) locale = INTL_G(default_locale); } +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { INTL_CTOR_CHECK_STATUS(mfo, "msgfmt_create: error converting pattern to quote-friendly format"); } +#endif if ((mfo)->mf_data.orig_format) { msgformat_data_free(&mfo->mf_data TSRMLS_CC); diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c index cf346651424..ed2dae27d13 100755 --- a/ext/intl/msgformat/msgformat_attr.c +++ b/ext/intl/msgformat/msgformat_attr.c @@ -82,11 +82,13 @@ PHP_FUNCTION( msgfmt_set_pattern ) intl_convert_utf8_to_utf16(&spattern, &spattern_len, value, value_len, &INTL_DATA_ERROR_CODE(mfo)); INTL_METHOD_CHECK_STATUS(mfo, "Error converting pattern to UTF-16" ); +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { intl_error_set( NULL, U_INVALID_FORMAT_ERROR, "msgfmt_set_pattern: error converting pattern to quote-friendly format", 0 TSRMLS_CC ); RETURN_FALSE; } +#endif /* TODO: add parse error information */ umsg_applyPattern(MSG_FORMAT_OBJECT(mfo), spattern, spattern_len, NULL, &INTL_DATA_ERROR_CODE(mfo)); diff --git a/ext/intl/msgformat/msgformat_class.h b/ext/intl/msgformat/msgformat_class.h index 0afa792ae3c..b6b8e33226e 100755 --- a/ext/intl/msgformat/msgformat_class.h +++ b/ext/intl/msgformat/msgformat_class.h @@ -19,9 +19,11 @@ #include -#include "intl_common.h" -#include "intl_error.h" -#include "intl_data.h" +#include + +#include "../intl_common.h" +#include "../intl_error.h" +#include "../intl_data.h" #include "msgformat_data.h" typedef struct { @@ -38,4 +40,8 @@ extern zend_class_entry *MessageFormatter_ce_ptr; #define MSG_FORMAT_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(MessageFormatter, mfo) #define MSG_FORMAT_OBJECT(mfo) (mfo)->mf_data.umsgf +#if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM < 48 +# define MSG_FORMAT_QUOTE_APOS 1 +#endif + #endif // #ifndef MSG_FORMAT_CLASS_H diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c index 95e81d3ea74..4f93d6d98c3 100755 --- a/ext/intl/msgformat/msgformat_data.c +++ b/ext/intl/msgformat/msgformat_data.c @@ -69,6 +69,7 @@ msgformat_data* msgformat_data_create( TSRMLS_D ) } /* }}} */ +#ifdef MSG_FORMAT_QUOTE_APOS int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec) { if(*spattern && *spattern_len && u_strchr(*spattern, (UChar)'\'')) { @@ -86,6 +87,7 @@ int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *e } return SUCCESS; } +#endif /* diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h index 44001753b35..6479888f8fc 100755 --- a/ext/intl/msgformat/msgformat_data.h +++ b/ext/intl/msgformat/msgformat_data.h @@ -19,9 +19,9 @@ #include -#include +#include "../intl_error.h" -#include "intl_error.h" +#include typedef struct { // error hangling @@ -36,6 +36,9 @@ typedef struct { msgformat_data* msgformat_data_create( TSRMLS_D ); void msgformat_data_init( msgformat_data* mf_data TSRMLS_DC ); void msgformat_data_free( msgformat_data* mf_data TSRMLS_DC ); + +#ifdef MSG_FORMAT_QUOTE_APOS int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec); +#endif #endif // MSG_FORMAT_DATA_H diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c index b664c83ec11..9a18ac0a70f 100755 --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -154,11 +154,13 @@ PHP_FUNCTION( msgfmt_format_message ) slocale = INTL_G(default_locale); } +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { intl_error_set( NULL, U_INVALID_FORMAT_ERROR, "msgfmt_format_message: error converting pattern to quote-friendly format", 0 TSRMLS_CC ); RETURN_FALSE; } +#endif /* Create an ICU message formatter. */ MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, slocale, NULL, &INTL_DATA_ERROR_CODE(mfo)); diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c index 8393d4c6e39..f540b1d0c4a 100755 --- a/ext/intl/msgformat/msgformat_parse.c +++ b/ext/intl/msgformat/msgformat_parse.c @@ -129,11 +129,13 @@ PHP_FUNCTION( msgfmt_parse_message ) slocale = INTL_G(default_locale); } +#ifdef MSG_FORMAT_QUOTE_APOS if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) { intl_error_set( NULL, U_INVALID_FORMAT_ERROR, "msgfmt_parse_message: error converting pattern to quote-friendly format", 0 TSRMLS_CC ); RETURN_FALSE; } +#endif /* Create an ICU message formatter. */ MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, slocale, NULL, &INTL_DATA_ERROR_CODE(mfo)); From c1ac3252288c2eeb0b9278458ad15e19912a945a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Wed, 6 Jun 2012 12:10:00 +0200 Subject: [PATCH 4/8] Fix ext/intl build on ICU < 4.8 --- ext/intl/msgformat/msgformat_data.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c index 4f93d6d98c3..527c1d4d179 100755 --- a/ext/intl/msgformat/msgformat_data.c +++ b/ext/intl/msgformat/msgformat_data.c @@ -21,6 +21,8 @@ #include #include "msgformat_data.h" +#include "msgformat_class.h" + /* {{{ void msgformat_data_init( msgformat_data* mf_data ) * Initialize internals of msgformat_data. */ From db1e425b1aecb152498bf908f188d5041767a33a Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Wed, 6 Jun 2012 23:00:33 -0700 Subject: [PATCH 5/8] restore NEWS --- NEWS | 84 ++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 28 deletions(-) diff --git a/NEWS b/NEWS index 363a8b7f252..d3448e950b7 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,58 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +?? ??? 2012, PHP 5.4.5 + +- Core: + . Fixed bug #61998 (Using traits with method aliases appears to result in + crash during execution). (Dmitry) + +- EXIF: + . Fixed information leak in ext exif (discovered by Martin Noga, + Matthew "j00ru" Jurczyk, Gynvael Coldwind) + +- FPM + . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) + . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) + . Fixed bug #62153 (when using unix sockets, multiples FPM instances + . Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). + (fat) + . Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm). (fat) + . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) + . Fixed bug #61295 (php-fpm should not fail with commented 'user' + . Fixed bug #61218 (FPM drops connection while receiving some binary values + in FastCGI requests). (fat) + . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) + for non-root start). (fat) + . Fixed bug #61026 (FPM pools can listen on the same address). (fat) + can be launched without errors). (fat) + +- Iconv: + . Fix bug #55042 (Erealloc in iconv.c unsafe). (Stas) + +- Intl + . ResourceBundle constructor now accepts NULL for the first two arguments. + (Gustavo) + +- Readline: + . Fixed bug #62186 (readline fails to compile - void function should not + return a value). (Johannes) + +- Reflection: + . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks + with constant). (Laruence) + +- Sockets: + . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) + +- XML Writer: + . Fixed bug #62064 (memory leak in the XML Writer module). + (jean-pierre dot lozi at lip6 dot fr) + ?? ??? 2012, PHP 5.4.4 +- COM: + . Fixed bug #62146 com_dotnet cannot be built shared. (Johannes) + - CLI Server: . Implemented FR #61977 (Need CLI web-server support for files with .htm & svg extensions). (Sixd, Laruence) @@ -17,10 +68,10 @@ PHP NEWS - Core: . Fixed missing bound check in iptcparse(). (chris at chiappa.net) + . Fixed CVE-2012-2143. (Solar Designer) + . Fixed bug #62097 (fix for for bug #54547). (Gustavo) . Fixed bug #62005 (unexpected behavior when incrementally assigning to a member of a null object). (Laruence) - . Fixed bug #61998 (Using traits with method aliases appears to result in - crash during execution). (Dmitry) . Fixed bug #61978 (Object recursion not detected for classes that implement JsonSerializable). (Felipe) . Fixed bug #61991 (long overflow in realpath_cache_get()). (Anatoliy) @@ -45,7 +96,7 @@ PHP NEWS . Changed php://fd to be available only for CLI. - Phar: - . Fix bug #61065 (Secunia SA44335). (Rasmus) + . Fix bug #61065 (Secunia SA44335, CVE-2012-2386). (Rasmus) - Pgsql: . Added pg_escape_identifier/pg_escape_literal. (Yasuo Ohgaki) @@ -54,36 +105,13 @@ PHP NEWS . Fixed bug #61812 (Uninitialised value used in libmagic). (Laruence, Gustavo) -- FPM - . Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat) - . Fixed bug #61835 (php-fpm is not allowed to run as root). (fat) - . Fixed bug #61295 (php-fpm should not fail with commented 'user' - for non-root start). (fat) - . Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm). (fat) - . Fixed bug #61026 (FPM pools can listen on the same address). (fat) - . Fixed bug #62033 (php-fpm exits with status 0 on some failures to start). - (fat) - . Fixed bug #62153 (when using unix sockets, multiples FPM instances - can be launched without errors). (fat) - . Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat) - . Fixed bug #61218 (FPM drops connection while receiving some binary values - in FastCGI requests). (fat) - . Fixed bug #62205 (php-fpm segfaults (null passed to strstr)). (fat) - - Intl - . ResourceBundle constructor now accepts NULL for the first two arguments. - (Gustavo) + . Fixed bug #62082 (Memory corruption in internal function + get_icu_disp_value_src_php()). (Gustavo) - Libxml: . Fixed bug #61617 (Libxml tests failed(ht is already destroyed)). (Laruence) - -- Sockets: - . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) - -- XML Writer: - . Fixed bug #62064 (memory leak in the XML Writer module). - (jean-pierre dot lozi at lip6 dot fr) - Zlib: . Fixed bug #61820 (using ob_gzhandler will complain about headers already From e118a0794a93e54d97ac42636e56c9b7e5904ecd Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Wed, 6 Jun 2012 23:20:14 -0700 Subject: [PATCH 6/8] merge 5.3 entries --- NEWS | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index d3448e950b7..9ab8b622ab9 100644 --- a/NEWS +++ b/NEWS @@ -30,16 +30,22 @@ PHP NEWS . Fix bug #55042 (Erealloc in iconv.c unsafe). (Stas) - Intl + . Fixed bug #62083 (grapheme_extract() memory leaks). (Gustavo) . ResourceBundle constructor now accepts NULL for the first two arguments. (Gustavo) + . Fixed bug #62081 (IntlDateFormatter constructor leaks memory when called + twice). (Gustavo) + . Fixed bug #62070 (Collator::getSortKey() returns garbage). (Gustavo) + . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks + pattern). (Gustavo) - Readline: . Fixed bug #62186 (readline fails to compile - void function should not return a value). (Johannes) - Reflection: - . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks - with constant). (Laruence) + . Fixed bug #62202 (ReflectionParameter::getDefaultValue() memory leaks + with constant). (Laruence) - Sockets: . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) @@ -104,6 +110,10 @@ PHP NEWS - Fileinfo . Fixed bug #61812 (Uninitialised value used in libmagic). (Laruence, Gustavo) + . Fixed bug #61566 failure caused by the posix lseek and read versions + under windows in cdf_read(). (Anatoliy) + . Fixed bug #61565 where php_stream_open_wrapper_ex tries to open a + directory descriptor under windows. (Anatoliy) - Intl . Fixed bug #62082 (Memory corruption in internal function @@ -697,6 +707,14 @@ PHP NEWS . Fixed bug #55544 (ob_gzhandler always conflicts with zlib.output_compression). (Mike) +08 May 2012, PHP 5.3.13 +- CGI + . Improve fix for PHP-CGI query string parameter vulnerability, CVE-2012-2311. + (Stas) + +03 May 2012, PHP 5.3.12 +- Fix PHP-CGI query string parameter vulnerability, CVE-2012-1823. (Rasmus) + 26 Apr 2012, PHP 5.3.11 - Core: From d9810af45ae9e3cbd2c97543b5dfa2d7c93e81c1 Mon Sep 17 00:00:00 2001 From: slayercat Date: Wed, 23 May 2012 20:30:16 +0800 Subject: [PATCH 7/8] based on microsoft's description,the direct convert from FILETIME struct to __int64 is unsafe. via http://technet.microsoft.com/en-us/library/ms724284(v=vs.85).aspx "Do not cast a pointer to a FILETIME structure to either a ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows." --- win32/time.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/win32/time.c b/win32/time.c index a376fd61be0..8b847b09ff0 100644 --- a/win32/time.c +++ b/win32/time.c @@ -1,4 +1,3 @@ - /***************************************************************************** * * * DH_TIME.C * @@ -37,10 +36,21 @@ int getfilesystemtime(struct timeval *time_Info) { FILETIME ft; __int64 ff; +ULARGE_INTEGER convFromft; GetSystemTimeAsFileTime(&ft); /* 100 ns blocks since 01-Jan-1641 */ /* resolution seems to be 0.01 sec */ - ff = *(__int64*)(&ft); + /* ff = *(__int64*)(&ft); */ + /* + Do not cast a pointer to a FILETIME structure to either a + ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows. + + via http://technet.microsoft.com/en-us/library/ms724284(v=vs.85).aspx + */ + convFromft.HighPart = ft.dwHighDateTime; + convFromft.LowPart = ft.dwLowDateTime; + ff = convFromft.QuadPart; + time_Info->tv_sec = (int)(ff/(__int64)10000000-(__int64)11644473600); time_Info->tv_usec = (int)(ff % 10000000)/10; return 0; From 6ecc9f1d9dfbfa264725aabcf52b75e31ce59deb Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Thu, 7 Jun 2012 14:31:35 +0800 Subject: [PATCH 8/8] Remove unused codes --- win32/time.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/win32/time.c b/win32/time.c index 8b847b09ff0..391a8a81e99 100644 --- a/win32/time.c +++ b/win32/time.c @@ -34,23 +34,21 @@ int getfilesystemtime(struct timeval *time_Info) { -FILETIME ft; -__int64 ff; -ULARGE_INTEGER convFromft; + FILETIME ft; + __int64 ff; + ULARGE_INTEGER convFromft; GetSystemTimeAsFileTime(&ft); /* 100 ns blocks since 01-Jan-1641 */ - /* resolution seems to be 0.01 sec */ - /* ff = *(__int64*)(&ft); */ + /* resolution seems to be 0.01 sec */ /* - Do not cast a pointer to a FILETIME structure to either a - ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows. - - via http://technet.microsoft.com/en-us/library/ms724284(v=vs.85).aspx + * Do not cast a pointer to a FILETIME structure to either a + * ULARGE_INTEGER* or __int64* value because it can cause alignment faults on 64-bit Windows. + * via http://technet.microsoft.com/en-us/library/ms724284(v=vs.85).aspx */ convFromft.HighPart = ft.dwHighDateTime; convFromft.LowPart = ft.dwLowDateTime; ff = convFromft.QuadPart; - + time_Info->tv_sec = (int)(ff/(__int64)10000000-(__int64)11644473600); time_Info->tv_usec = (int)(ff % 10000000)/10; return 0;