[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/ext/dom/tests/DOMAttr_value_basic_001.phpt branches/PHP_5_2/ext/dom/tests/DOMCharacterData_appendData_basic.phpt branches/PHP_5_2/ext/dom/tests/DOMCharact
wharmby Fri, 11 Sep 2009 21:57:04 + Revision: http://svn.php.net/viewvc?view=revision&revision=288274 Log: Add missing SKIPIF Changed paths: U php/php-src/branches/PHP_5_2/ext/dom/tests/DOMAttr_value_basic_001.phpt U php/php-src/branches/PHP_5_2/ext/dom/tests/DOMCharacterData_appendData_basic.phpt U php/php-src/branches/PHP_5_2/ext/dom/tests/DOMCharacterData_length_error_001.phpt U php/php-src/branches/PHP_5_2/ext/dom/tests/DOMText_appendData_basic.phpt U php/php-src/branches/PHP_5_2/ext/dom/tests/bug42082.phpt U php/php-src/branches/PHP_5_2/ext/dom/tests/bug43364.phpt U php/php-src/branches/PHP_5_2/ext/dom/tests/domdocument_createcomment_error_001.phpt U php/php-src/branches/PHP_5_2/ext/dom/tests/domdocument_createentityreference_001.phpt U php/php-src/branches/PHP_5_2/ext/dom/tests/domdocument_createentityreference_002.phpt U php/php-src/branches/PHP_5_3/ext/dom/tests/DOMAttr_value_basic_001.phpt U php/php-src/branches/PHP_5_3/ext/dom/tests/DOMCharacterData_length_error_001.phpt U php/php-src/branches/PHP_5_3/ext/dom/tests/DOMText_appendData_basic.phpt U php/php-src/branches/PHP_5_3/ext/dom/tests/bug42082.phpt U php/php-src/branches/PHP_5_3/ext/dom/tests/domdocument_createcomment_error_001.phpt U php/php-src/branches/PHP_5_3/ext/dom/tests/domdocument_createentityreference_001.phpt U php/php-src/branches/PHP_5_3/ext/dom/tests/domdocument_createentityreference_002.phpt U php/php-src/trunk/ext/dom/tests/DOMAttr_value_basic_001.phpt U php/php-src/trunk/ext/dom/tests/DOMCharacterData_length_error_001.phpt U php/php-src/trunk/ext/dom/tests/DOMText_appendData_basic.phpt U php/php-src/trunk/ext/dom/tests/bug42082.phpt U php/php-src/trunk/ext/dom/tests/domdocument_createcomment_error_001.phpt U php/php-src/trunk/ext/dom/tests/domdocument_createentityreference_001.phpt U php/php-src/trunk/ext/dom/tests/domdocument_createentityreference_002.phpt Modified: php/php-src/branches/PHP_5_2/ext/dom/tests/DOMAttr_value_basic_001.phpt === --- php/php-src/branches/PHP_5_2/ext/dom/tests/DOMAttr_value_basic_001.phpt 2009-09-11 21:26:18 UTC (rev 288273) +++ php/php-src/branches/PHP_5_2/ext/dom/tests/DOMAttr_value_basic_001.phpt 2009-09-11 21:57:04 UTC (rev 288274) @@ -3,9 +3,14 @@ --CREDIT-- Jason Bouffard # TestFest Atlanta 2009-05-14 +--SKIPIF-- + --FILE-- value."\n"; ?> +===DONE=== --EXPECTF-- +===DONE=== + \ No newline at end of file Modified: php/php-src/branches/PHP_5_2/ext/dom/tests/DOMCharacterData_appendData_basic.phpt === --- php/php-src/branches/PHP_5_2/ext/dom/tests/DOMCharacterData_appendData_basic.phpt 2009-09-11 21:26:18 UTC (rev 288273) +++ php/php-src/branches/PHP_5_2/ext/dom/tests/DOMCharacterData_appendData_basic.phpt 2009-09-11 21:57:04 UTC (rev 288274) @@ -3,6 +3,8 @@ --CREDITS-- Mike Sullivan #TestFest 2008 (London) +--SKIPIF-- + --FILE-- saveXML(); ?> +===DONE=== --EXPECT-- CDATA Length (one append): 4 CDATA Length (two appends): 8 CDATA Content: data><&" - \ No newline at end of file + +===DONE=== + \ No newline at end of file Modified: php/php-src/branches/PHP_5_2/ext/dom/tests/DOMCharacterData_length_error_001.phpt === --- php/php-src/branches/PHP_5_2/ext/dom/tests/DOMCharacterData_length_error_001.phpt 2009-09-11 21:26:18 UTC (rev 288273) +++ php/php-src/branches/PHP_5_2/ext/dom/tests/DOMCharacterData_length_error_001.phpt 2009-09-11 21:57:04 UTC (rev 288274) @@ -3,10 +3,15 @@ --CREDIT-- Jason Bouffard # TestFest Atlanta 2009-05-14 +--SKIPIF-- + --FILE-- length; ?> +===DONE=== --EXPECTF-- -Warning: main(): Invalid State Error in %s \ No newline at end of file +Warning: main(): Invalid State Error in %s +===DONE=== + \ No newline at end of file Modified: php/php-src/branches/PHP_5_2/ext/dom/tests/DOMText_appendData_basic.phpt === --- php/php-src/branches/PHP_5_2/ext/dom/tests/DOMText_appendData_basic.phpt 2009-09-11 21:26:18 UTC (rev 288273) +++ php/php-src/branches/PHP_5_2/ext/dom/tests/DOMText_appendData_basic.phpt 2009-09-11 21:57:04 UTC (rev 288274) @@ -3,6 +3,8 @@ --CREDITS-- Mike Sullivan #TestFest 2008 (London) +--SKIPIF-- + --FILE-- saveXML(); ?> +===DONE=== --EXPECT-- Text Length (one append): 4 Text Length (two appends): 8 Text Content: data><&" -data><&" \ No newline at end of file +data><&" +===DONE=== + \ No newline at end of file Modified: php/php-src/branches/PHP_5_2/ext/dom/tests/bug42082.phpt === --- php/php-src/branches/PHP_5_2/ext/dom/tests/bug42082.phpt 2009-09-11 21:26:18 UTC (rev 288273) +++ php/php-src/branches/PHP_5_2/ext/dom/tes
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mbstring/libmbfl/filters/mbfilter_utf8.c branches/PHP_5_3/ext/mbstring/libmbfl/mbfl/mbfilter.c branches/PHP_5_3/ext/mbstring/tests/bug49536.phpt trunk
moriyoshiFri, 11 Sep 2009 21:26:18 + Revision: http://svn.php.net/viewvc?view=revision&revision=288273 Log: - Fix bug #49536 (mb_detect_encoding() returns incorrect results when strict_mode is turned on.) (patch by komura, thanks!) Bug: http://bugs.php.net/49536 (Open) mb_detect_encoding() returns incorrect results when strict_mode is turned on Changed paths: U php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/filters/mbfilter_utf8.c U php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/mbfl/mbfilter.c A php/php-src/branches/PHP_5_3/ext/mbstring/tests/bug49536.phpt U php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf8.c U php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfilter.c A php/php-src/trunk/ext/mbstring/tests/bug49536.phpt Modified: php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/filters/mbfilter_utf8.c === --- php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/filters/mbfilter_utf8.c 2009-09-11 16:43:49 UTC (rev 288272) +++ php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/filters/mbfilter_utf8.c 2009-09-11 21:26:18 UTC (rev 288273) @@ -220,7 +220,7 @@ if (c < 0x80) { if (c < 0) { filter->flag = 1; /* bad */ - } else if (c != 0 && filter->status) { + } else if (filter->status) { filter->flag = 1; /* bad */ } filter->status = 0; Modified: php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/mbfl/mbfilter.c === --- php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/mbfl/mbfilter.c 2009-09-11 16:43:49 UTC (rev 288272) +++ php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/mbfl/mbfilter.c 2009-09-11 21:26:18 UTC (rev 288273) @@ -622,7 +622,7 @@ if (!encoding) { for (i = 0; i < num; i++) { filter = &flist[i]; - if (!filter->flag) { + if (!filter->flag && (!strict || !filter->status)) { encoding = filter->encoding; break; } Added: php/php-src/branches/PHP_5_3/ext/mbstring/tests/bug49536.phpt === --- php/php-src/branches/PHP_5_3/ext/mbstring/tests/bug49536.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/mbstring/tests/bug49536.phpt 2009-09-11 21:26:18 UTC (rev 288273) @@ -0,0 +1,20 @@ +--TEST-- +Bug #49536 (mb_detect_encoding() returns incorrect results when strict_mode is turned on) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(4) "SJIS" +bool(false) +string(5) "UTF-8" +bool(false) Modified: php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf8.c === --- php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf8.c 2009-09-11 16:43:49 UTC (rev 288272) +++ php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf8.c 2009-09-11 21:26:18 UTC (rev 288273) @@ -220,7 +220,7 @@ if (c < 0x80) { if (c < 0) { filter->flag = 1; /* bad */ - } else if (c != 0 && filter->status) { + } else if (filter->status) { filter->flag = 1; /* bad */ } filter->status = 0; Modified: php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfilter.c === --- php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfilter.c 2009-09-11 16:43:49 UTC (rev 288272) +++ php/php-src/trunk/ext/mbstring/libmbfl/mbfl/mbfilter.c 2009-09-11 21:26:18 UTC (rev 288273) @@ -622,7 +622,7 @@ if (!encoding) { for (i = 0; i < num; i++) { filter = &flist[i]; - if (!filter->flag) { + if (!filter->flag && (!strict || !filter->status)) { encoding = filter->encoding; break; } Added: php/php-src/trunk/ext/mbstring/tests/bug49536.phpt === --- php/php-src/trunk/ext/mbstring/tests/bug49536.phpt (rev 0) +++ php/php-src/trunk/ext/mbstring/tests/bug49536.phpt 2009-09-11 21:26:18 UTC (rev 288273) @@ -0,0 +1,20 @@ +--TEST-- +Bug #49536 (mb_detect_encoding() returns incorrect results when strict_mode is turned on) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(4) "SJIS" +bool(false) +string(5) "UTF-8" +bool(false) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt trunk/ext/mysqli/mysqli_api.c trunk/ext/mysqli/tests/mysqli_stmt_fet
uw Fri, 11 Sep 2009 13:38:47 + Revision: http://svn.php.net/viewvc?view=revision&revision=288267 Log: Fix for bug #49357 (MySQLi extension fails to recognize POINT (spatial) colums). Do yourself a favour and use mysqlnd. mysqlnd has no isuses here. If you insist on using the MySQL Client Library (libmysql) I strongly recommend to use mysqli_stmt_store_result() when fetching geometry data using prepared statements. When streaming data, which is the default for prepared statements, ext/mysqli will have to make a guess on the size of the result buffer it needs. The guess is based on a length reported by the MySQL CLient Library (libmysql). The MySQL Client Library reports 4GB (!) for a POINT - a conservative and safe guess. Consequently, ext/mysqli will try to allocate 4GB of RAM. The true (maximum) size of the column is not available before buffering the result on the client using mysqli_stmt_store_result(). If you call mysqli_stmt_store_result(), the result buffers will not get bigger than needed. However, store_result()/buffering is usually not what you want when you ask for prepared statements. Bug: http://bugs.php.net/49357 (Verified) MySQLi extension fails to recognize POINT (spatial) colums Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 12:47:20 UTC (rev 288266) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 13:38:47 UTC (rev 288267) @@ -370,6 +370,7 @@ case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_GEOMETRY: #ifdef FIELD_TYPE_NEWDECIMAL case MYSQL_TYPE_NEWDECIMAL: #endif @@ -2283,7 +2284,8 @@ for (i = mysql_stmt_field_count(stmt->stmt) - 1; i >=0; --i) { if (stmt->stmt->fields && (stmt->stmt->fields[i].type == MYSQL_TYPE_BLOB || stmt->stmt->fields[i].type == MYSQL_TYPE_MEDIUM_BLOB || - stmt->stmt->fields[i].type == MYSQL_TYPE_LONG_BLOB)) + stmt->stmt->fields[i].type == MYSQL_TYPE_LONG_BLOB || + stmt->stmt->fields[i].type == MYSQL_TYPE_GEOMETRY)) { my_bool tmp=1; mysql_stmt_attr_set(stmt->stmt, STMT_ATTR_UPDATE_MAX_LENGTH, &tmp); Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt 2009-09-11 12:47:20 UTC (rev 288266) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt 2009-09-11 13:38:47 UTC (rev 288267) @@ -45,7 +45,7 @@ return false; } - if (!mysqli_stmt_execute($stmt)) { + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_store_result($stmt)) { printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); mysqli_stmt_close($stmt); return false; @@ -65,7 +65,7 @@ $num = 0; $rows = array(); - while (true === mysqli_stmt_fetch($stmt)) { + while (true === @mysqli_stmt_fetch($stmt)) { $rows[] = array('id' => $id, 'label' => $bind_res); $num++; } Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 12:47:20 UTC (rev 288266) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 13:38:47 UTC (rev 288267) @@ -370,6 +370,7 @@ case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_GEOMETRY: #ifdef FIELD_TYPE_NEWDECIMAL case MYSQL_TYPE_NEWDECIMAL: #endif @@ -2346,7 +2347,8 @@ for (i = mysql_stmt_field_count(stmt->stmt) - 1; i >=0; --i) { if (stmt->stmt->fields && (stmt->stmt->fields[i].type == MYSQL_TYPE_BLOB || stmt->stmt->fields[i].type == MYSQL_TYPE_MEDIUM_BLOB || - stmt-
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h branches/PHP_5_3/ext/mysqli/tests/005.phpt trunk/ext/mysqli/mysqli_api.c trun
What about fixing it also in PHP_5_2 ?? Or doesn't this exist there? ;) Sounds quite critical to be in there.. --Jani On 09/11/2009 03:16 PM, Ulf Wendel wrote: uw Fri, 11 Sep 2009 12:16:56 + Revision: http://svn.php.net/viewvc?view=revision&revision=288263 Log: Fixing a crash which must have existed since PHP 5.0. At least the crash can be reproduced with PHP 5.0.6. The crash happens only when using the MySQL Client Library (libmysql) - it does not happen when using mysqlnd. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h U php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/php_mysqli_structs.h U php/php-src/trunk/ext/mysqli/tests/005.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 12:16:56 UTC (rev 288263) @@ -409,7 +409,7 @@ bind[ofs].buffer = stmt->result.buf[ofs].val; bind[ofs].is_null =&stmt->result.is_null[ofs]; bind[ofs].buffer_length = stmt->result.buf[ofs].buflen; - bind[ofs].length =&stmt->result.buf[ofs].buflen; + bind[ofs].length =&stmt->result.buf[ofs].output_len; break; } default: @@ -916,7 +916,7 @@ { #endif ZVAL_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val, - stmt->result.buf[i].buflen, 1); + stmt->result.buf[i].output_len, 1); } } break; Modified: php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h === --- php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2009-09-11 12:16:56 UTC (rev 288263) @@ -73,8 +73,9 @@ }; typedef struct { + char*val; ulong buflen; - char*val; + ulong output_len; ulong type; } VAR_BUFFER; Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt 2009-09-11 12:16:56 UTC (rev 288263) @@ -32,6 +32,9 @@ var_dump($test); + /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */ + mysqli_fetch($stmt); + mysqli_stmt_close($stmt); mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); mysqli_close($link); Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 12:16:56 UTC (rev 288263) @@ -409,7 +409,7 @@ bind[ofs].buffer = stmt->result.buf[ofs].val; bind[ofs].is_null =&stmt->result.is_null[ofs]; bind[ofs].buffer_length = stmt->result.buf[ofs].buflen; - bind[ofs].length =&stmt->result.buf[ofs].buflen; + bind[ofs].length =&stmt->result.buf[ofs].output_len; break; } default: @@ -955,7 +955,7 @@ } else #endif { - copy_len = stmt->result.buf[i].buflen; + copy_len = stmt->result.buf[i].output_len; } if (!IS_BINARY_DATA(fields[i])) {
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
uw Fri, 11 Sep 2009 12:28:47 + Revision: http://svn.php.net/viewvc?view=revision&revision=288265 Log: Stepping back to PHP 5.2.x and earlier logic of allocating even huge pieces of memory for large BLOB types to avoid data truncation. This fixes the test failure of 005.phpt when using MySQL Client Library (libmysql). The test does pass with mysqlnd because mysqlnd does not have any issues here. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/mysqli_api.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 12:27:29 UTC (rev 288264) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 12:28:47 UTC (rev 288265) @@ -395,7 +395,9 @@ different lengths and you will see that we get different lengths in stmt->stmt->fields[ofs].length The just take 256 and saves us from realloc-ing. */ - stmt->result.buf[ofs].buflen = 256; + stmt->result.buf[ofs].buflen = + (stmt->stmt->fields) ? (stmt->stmt->fields[ofs].length) ? stmt->stmt->fields[ofs].length + 1: 256: 256; + } else { /* the user has called store_result(). if he does not there is no way to determine the Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 12:27:29 UTC (rev 288264) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 12:28:47 UTC (rev 288265) @@ -395,7 +395,9 @@ different lengths and you will see that we get different lengths in stmt->stmt->fields[ofs].length The just take 256 and saves us from realloc-ing. */ - stmt->result.buf[ofs].buflen = 256; + stmt->result.buf[ofs].buflen = + (stmt->stmt->fields) ? (stmt->stmt->fields[ofs].length) ? stmt->stmt->fields[ofs].length + 1: 256: 256; + } else { /* the user has called store_result(). if he does not there is no way to determine the -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h branches/PHP_5_3/ext/mysqli/tests/005.phpt trunk/ext/mysqli/mysqli_api.c trunk/ex
uw Fri, 11 Sep 2009 12:16:56 + Revision: http://svn.php.net/viewvc?view=revision&revision=288263 Log: Fixing a crash which must have existed since PHP 5.0. At least the crash can be reproduced with PHP 5.0.6. The crash happens only when using the MySQL Client Library (libmysql) - it does not happen when using mysqlnd. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h U php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/php_mysqli_structs.h U php/php-src/trunk/ext/mysqli/tests/005.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 12:16:56 UTC (rev 288263) @@ -409,7 +409,7 @@ bind[ofs].buffer = stmt->result.buf[ofs].val; bind[ofs].is_null = &stmt->result.is_null[ofs]; bind[ofs].buffer_length = stmt->result.buf[ofs].buflen; - bind[ofs].length = &stmt->result.buf[ofs].buflen; + bind[ofs].length = &stmt->result.buf[ofs].output_len; break; } default: @@ -916,7 +916,7 @@ { #endif ZVAL_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val, - stmt->result.buf[i].buflen, 1); + stmt->result.buf[i].output_len, 1); } } break; Modified: php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h === --- php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2009-09-11 12:16:56 UTC (rev 288263) @@ -73,8 +73,9 @@ }; typedef struct { + char*val; ulong buflen; - char*val; + ulong output_len; ulong type; } VAR_BUFFER; Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt 2009-09-11 12:16:56 UTC (rev 288263) @@ -32,6 +32,9 @@ var_dump($test); + /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */ + mysqli_fetch($stmt); + mysqli_stmt_close($stmt); mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); mysqli_close($link); Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 12:16:56 UTC (rev 288263) @@ -409,7 +409,7 @@ bind[ofs].buffer = stmt->result.buf[ofs].val; bind[ofs].is_null = &stmt->result.is_null[ofs]; bind[ofs].buffer_length = stmt->result.buf[ofs].buflen; - bind[ofs].length = &stmt->result.buf[ofs].buflen; + bind[ofs].length = &stmt->result.buf[ofs].output_len; break; } default: @@ -955,7 +955,7 @@ } else #endif { - copy_len = stmt->result.buf[i].buflen; + copy_len = stmt->result.buf[i].output_len; } if (!IS_BINARY_DATA(fields[i])) { ZVAL_UTF8_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val, Modified: php/php-src/trunk/ext/mysqli/php_mysqli_structs.h
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mbstring/libmbfl/filters/mbfilter_utf16.c branches/PHP_5_3/ext/mbstring/tests/bug49528.phpt trunk/ext/mbstring/libmbfl/filters/mbfilter_utf16.c trunk/
moriyoshiFri, 11 Sep 2009 08:22:19 + Revision: http://svn.php.net/viewvc?view=revision&revision=288260 Log: - Fix bug #49528 (UTF-16 strings prefixed by BOM wrongly converted). Bug: http://bugs.php.net/49528 (Assigned) UTF-16 strings prefixed by BOMs wrondly converted Changed paths: U php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/filters/mbfilter_utf16.c A php/php-src/branches/PHP_5_3/ext/mbstring/tests/bug49528.phpt U php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf16.c A php/php-src/trunk/ext/mbstring/tests/bug49528.phpt Modified: php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/filters/mbfilter_utf16.c === --- php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/filters/mbfilter_utf16.c 2009-09-11 06:43:09 UTC (rev 288259) +++ php/php-src/branches/PHP_5_3/ext/mbstring/libmbfl/filters/mbfilter_utf16.c 2009-09-11 08:22:19 UTC (rev 288260) @@ -127,7 +127,7 @@ int n, endian; endian = filter->status & 0xff00; - switch (filter->status & 0xff) { + switch (filter->status & 0x0f) { case 0: if (endian) { n = c & 0xff; @@ -144,15 +144,8 @@ n = c & 0xff; } n |= filter->cache & 0x; - filter->status &= ~0xff; - if (n == 0xfffe) { - if (endian) { - filter->status = 0; /* big-endian */ - } else { - filter->status = 0x100; /* little-endian */ - } - CK((*filter->output_function)(0xfeff, filter->data)); - } else if (n >= 0xd800 && n < 0xdc00) { + filter->status &= ~0x0f; + if (n >= 0xd800 && n < 0xdc00) { filter->cache = ((n & 0x3ff) << 16) + 0x40; } else if (n >= 0xdc00 && n < 0xe000) { n &= 0x3ff; @@ -166,7 +159,21 @@ CK((*filter->output_function)(n, filter->data)); } } else { + int is_first = filter->status & 0x10; filter->cache = 0; + filter->status |= 0x10; + if (!is_first) { + if (n == 0xfffe) { + if (endian) { + filter->status &= ~0x100; /* big-endian */ + } else { + filter->status |= 0x100; /* little-endian */ + } + break; + } else if (n == 0xfeff) { + break; + } + } CK((*filter->output_function)(n, filter->data)); } break; Added: php/php-src/branches/PHP_5_3/ext/mbstring/tests/bug49528.phpt === --- php/php-src/branches/PHP_5_3/ext/mbstring/tests/bug49528.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/mbstring/tests/bug49528.phpt 2009-09-11 08:22:19 UTC (rev 288260) @@ -0,0 +1,20 @@ +--TEST-- +Bug #49528 (UTF-16 strings prefixed by BOM wrongly converted) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(8) "02010403" +string(8) "01020304" +string(12) "feff02010403" +string(12) "fffe02010403" +string(12) "fffe01020304" +string(12) "feff01020304" Modified: php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf16.c === --- php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf16.c 2009-09-11 06:43:09 UTC (rev 288259) +++ php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf16.c 2009-09-11 08:22:19 UTC (rev 288260) @@ -127,7 +127,7 @@ int n, endian; endian = filter->status & 0xff00; - switch (filter->status & 0xff) { + switch (filter->status & 0x0f) { case 0: if (endian) { n = c & 0xff; @@ -144,15 +144,8 @@ n = c & 0xff; } n |= filter->cache & 0x; - filter->status &= ~0xff; - if (n == 0xfffe) { - if (endian) { - filter->status = 0; /* big-endian */ - } else { - filter->status = 0x100; /* little-endian */ - } - CK((*filter->output_function)(0xfeff, filter->data)); - } el