[PHP-CVS] com php-src: Merge branch 'PHP-5.5': Zend/zend_vm_def.h Zend/zend_vm_execute.h
Commit:f6260b36dd5760bc2e3854db76f829fda54fe6df Author:Xinchen Hui larue...@php.net Mon, 14 Jan 2013 16:24:26 +0800 Parents: 5c7ae74f1098c6fe9555fc8d8dcad3a565e6a089 62059c16ee2f2802caa00f2aad2fa44c867dd1f1 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f6260b36dd5760bc2e3854db76f829fda54fe6df Log: Merge branch 'PHP-5.5' Changed paths: MM Zend/zend_vm_def.h MM Zend/zend_vm_execute.h Diff: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /SVNROOT/ global_avail
bjoriMon, 14 Jan 2013 08:24:43 + Revision: http://svn.php.net/viewvc?view=revisionrevision=329134 Log: doc karma for ole aass Changed paths: U SVNROOT/global_avail Modified: SVNROOT/global_avail === --- SVNROOT/global_avail2013-01-14 07:24:17 UTC (rev 329133) +++ SVNROOT/global_avail2013-01-14 08:24:43 UTC (rev 329134) @@ -101,7 +101,7 @@ avail|aferreira,thiago|phpdoc/pt avail|machado,scar,davis,dnfeitosa,thiago,amandavale,rafa,klaussilveira,kinncj|phpdoc/pt_BR avail|radical,shoty|phpdoc/ro -avail|aur,irker|phpdoc/en +avail|aur,irker,oaass|phpdoc/en avail|freespace,shafff,sveta,wanderer,kozloffsky,santiago,seprize,irker,mch,aur,das,tmn,bfl,countzero,alien,northcat|phpdoc/ru avail|cumhuronat,gulenzek,xhandros,neoprobe,faruk,infralite,flarecaster,antimon,yelekin,ecamalan|phpdoc/tr avail|pfischer|phpdoc/es -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #63980 (object members get trimmed by zero bytes): NEWS Zend/zend.c Zend/zend_builtin_functions.c Zend/zend_compile.c Zend/zend_compile.h Zend/zend_vm_def.h Zend/zend_
Commit:62059c16ee2f2802caa00f2aad2fa44c867dd1f1 Author:Xinchen Hui larue...@php.net Mon, 14 Jan 2013 16:23:22 +0800 Parents: fe27146b1b533e046e9a5841bb6e5685296208a8 Branches: PHP-5.5 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=62059c16ee2f2802caa00f2aad2fa44c867dd1f1 Log: Fixed bug #63980 (object members get trimmed by zero bytes) Bugs: https://bugs.php.net/63980 Changed paths: M NEWS M Zend/zend.c M Zend/zend_builtin_functions.c M Zend/zend_compile.c M Zend/zend_compile.h M Zend/zend_vm_def.h M Zend/zend_vm_execute.h Diff: diff --git a/NEWS b/NEWS index e79501f..c31365e 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||| ?? ??? 201?, PHP 5.5.0 Alpha 3 +- Core: + . Fixed bug #63980 (object members get trimmed by zero bytes). (Laruence) + - General improvements: . Fixed bug #63874 (Segfault if php_strip_whitespace has heredoc). (Pierrick) . Fixed bug #63822 (Crash when using closures with ArrayAccess). diff --git a/Zend/zend.c b/Zend/zend.c index d71d7cb..aad6165 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -158,9 +158,10 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, case HASH_KEY_IS_STRING: if (is_object) { const char *prop_name, *class_name; - int mangled = zend_unmangle_property_name(string_key, str_len - 1, class_name, prop_name); + int prop_len; + int mangled = zend_unmangle_property_name_ex(string_key, str_len - 1, class_name, prop_name, prop_len); - ZEND_PUTS_EX(prop_name); + ZEND_WRITE_EX(prop_name, prop_len); if (class_name mangled == SUCCESS) { if (class_name[0]=='*') { ZEND_PUTS_EX(:protected); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 7bbb047..4d950a2 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -987,7 +987,7 @@ ZEND_FUNCTION(get_object_vars) HashPosition pos; char *key; const char *prop_name, *class_name; - uint key_len; + uint key_len, prop_len; ulong num_index; zend_object *zobj; @@ -1014,10 +1014,10 @@ ZEND_FUNCTION(get_object_vars) while (zend_hash_get_current_data_ex(properties, (void **) value, pos) == SUCCESS) { if (zend_hash_get_current_key_ex(properties, key, key_len, num_index, 0, pos) == HASH_KEY_IS_STRING) { if (zend_check_property_access(zobj, key, key_len-1 TSRMLS_CC) == SUCCESS) { - zend_unmangle_property_name(key, key_len-1, class_name, prop_name); + zend_unmangle_property_name_ex(key, key_len - 1, class_name, prop_name, prop_len); /* Not separating references */ Z_ADDREF_PP(value); - add_assoc_zval_ex(return_value, prop_name, strlen(prop_name)+1, *value); + add_assoc_zval_ex(return_value, prop_name, prop_len + 1, *value); } } zend_hash_move_forward_ex(properties, pos); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 101662c..a5d6add 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5178,7 +5178,7 @@ static int zend_strnlen(const char* s, int maxlen) /* {{{ */ } /* }}} */ -ZEND_API int zend_unmangle_property_name(const char *mangled_property, int len, const char **class_name, const char **prop_name) /* {{{ */ +ZEND_API int zend_unmangle_property_name_ex(const char *mangled_property, int len, const char **class_name, const char **prop_name, int *prop_len) /* {{{ */ { int class_name_len; @@ -5186,22 +5186,34 @@ ZEND_API int zend_unmangle_property_name(const char *mangled_property, int len, if (mangled_property[0]!=0) { *prop_name = mangled_property; + if (prop_len) { + *prop_len = len; + } return SUCCESS; } if (len 3 || mangled_property[1]==0) { zend_error(E_NOTICE, Illegal member variable name); *prop_name = mangled_property; + if (prop_len) { + *prop_len = len; + } return FAILURE; } - class_name_len = zend_strnlen(mangled_property+1, --len - 1) + 1; + class_name_len = zend_strnlen(mangled_property
Re: [PHP-CVS] com php-src: Fixed bug #63980 (object members get trimmed by zero bytes): NEWS Zend/zend.c Zend/zend_builtin_functions.c Zend/zend_compile.c Zend/zend_compile.h Zend/zend_vm_def.h Zend/z
Hi! Commit:62059c16ee2f2802caa00f2aad2fa44c867dd1f1 Author:Xinchen Hui larue...@php.net Mon, 14 Jan 2013 16:23:22 +0800 Parents: fe27146b1b533e046e9a5841bb6e5685296208a8 Branches: PHP-5.5 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=62059c16ee2f2802caa00f2aad2fa44c867dd1f1 Log: Fixed bug #63980 (object members get trimmed by zero bytes) Do we really need this? I'm not sure supporting arbitrary-named properties is really that useful and worth adding complications to the engine. What is it useful for? -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] com php-src: Fixed bug #63980 (object members get trimmed by zero bytes): NEWS Zend/zend.c Zend/zend_builtin_functions.c Zend/zend_compile.c Zend/zend_compile.h Zend/zend_vm_def.h Zend/z
On Mon, Jan 14, 2013 at 4:37 PM, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! Commit:62059c16ee2f2802caa00f2aad2fa44c867dd1f1 Author:Xinchen Hui larue...@php.net Mon, 14 Jan 2013 16:23:22 +0800 Parents: fe27146b1b533e046e9a5841bb6e5685296208a8 Branches: PHP-5.5 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=62059c16ee2f2802caa00f2aad2fa44c867dd1f1 Log: Fixed bug #63980 (object members get trimmed by zero bytes) Do we really need this? I'm not sure supporting arbitrary-named properties is really that useful and worth adding complications to the engine. What is it useful for? Hey: 1. consistent 2. save unnecessary strlen calls thanks -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- Laruence Xinchen Hui http://www.laruence.com/ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Use zend_unmangle_property_name_ex to save strlen: Zend/zend_compile.c Zend/zend_object_handlers.c ext/standard/http.c
Commit:be07f815f240803fe7a48a5fb3d68a169bef4707 Author:Xinchen Hui larue...@php.net Mon, 14 Jan 2013 17:08:21 +0800 Parents: 62059c16ee2f2802caa00f2aad2fa44c867dd1f1 Branches: PHP-5.5 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be07f815f240803fe7a48a5fb3d68a169bef4707 Log: Use zend_unmangle_property_name_ex to save strlen Changed paths: M Zend/zend_compile.c M Zend/zend_object_handlers.c M ext/standard/http.c Diff: diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index a5d6add..43b8916 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4221,9 +4221,8 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { prop_name_length = property_info-name_length; } else { /* for private and protected we need to unmangle the names */ - zend_unmangle_property_name(property_info-name, property_info-name_length, - class_name_unused, prop_name); - prop_name_length = strlen(prop_name); + zend_unmangle_property_name_ex(property_info-name, property_info-name_length, + class_name_unused, prop_name, prop_name_length); prop_hash = zend_get_hash_value(prop_name, prop_name_length + 1); } diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 2c2a45d..20d4e12 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -363,9 +363,10 @@ ZEND_API int zend_check_property_access(zend_object *zobj, const char *prop_info zend_property_info *property_info; const char *class_name, *prop_name; zval member; + int prop_name_len; - zend_unmangle_property_name(prop_info_name, prop_info_name_len, class_name, prop_name); - ZVAL_STRING(member, prop_name, 0); + zend_unmangle_property_name_ex(prop_info_name, prop_info_name_len, class_name, prop_name, prop_name_len); + ZVAL_STRINGL(member, prop_name, prop_name_len, 0); property_info = zend_get_property_info_quick(zobj-ce, member, 1, NULL TSRMLS_CC); if (!property_info) { return FAILURE; diff --git a/ext/standard/http.c b/ext/standard/http.c index 3e50735..547df52 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -69,12 +69,11 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, const char *tmp; zend_object *zobj = zend_objects_get_address(type TSRMLS_CC); - if (zend_check_property_access(zobj, key, key_len-1 TSRMLS_CC) != SUCCESS) { + if (zend_check_property_access(zobj, key, key_len TSRMLS_CC) != SUCCESS) { /* private or protected property access outside of the class */ continue; } - zend_unmangle_property_name(key, key_len-1, tmp, (const char**)key); - key_len = strlen(key); + zend_unmangle_property_name_ex(key, key_len, tmp, (const char**)key, key_len); } if (zend_hash_get_current_data_ex(ht, (void **)zdata, NULL) == FAILURE || !zdata || !(*zdata)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #63921: sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API: NEWS ext/sqlite3/sqlite3.c ext/sqlite3/tests/bug63921-32bit.phpt ext/sqlite3/te
Commit:99d087e5d437023c55f96dcde4b5b784bd8b0ac8 Author:Lars Strojny lstro...@php.net Mon, 14 Jan 2013 17:35:07 +0100 Parents: 1a96fe0b3260b4b63627cf69d71a5b350ad3163f Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=99d087e5d437023c55f96dcde4b5b784bd8b0ac8 Log: Fixed bug #63921: sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API Bugs: https://bugs.php.net/63921 Changed paths: M NEWS M ext/sqlite3/sqlite3.c A ext/sqlite3/tests/bug63921-32bit.phpt A ext/sqlite3/tests/bug63921-64bit.phpt Diff: diff --git a/NEWS b/NEWS index 28040f7..e411ba4 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,10 @@ PHP NEWS - Litespeed: . Fixed bug #63228 (-Werror=format-security error in lsapi code). (George) +- ext/sqlite3: + . Fixed bug #63921 (sqlite3::bindvalue and relative PHP functions aren't +using sqlite3_*_int64 API). (srgoogleguy, Lars) + ?? ??? 2012, PHP 5.4.11 - Core: diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 881e3c3..df449d7 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -730,7 +730,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: +#if LONG_MAX 2147483647 + ZVAL_LONG(*zargs[i + is_agg], sqlite3_value_int64(argv[i])); +#else ZVAL_LONG(*zargs[i + is_agg], sqlite3_value_int(argv[i])); +#endif break; case SQLITE_FLOAT: @@ -774,7 +778,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s if (retval) { switch (Z_TYPE_P(retval)) { case IS_LONG: +#if LONG_MAX 2147483647 + sqlite3_result_int64(context, Z_LVAL_P(retval)); +#else sqlite3_result_int(context, Z_LVAL_P(retval)); +#endif break; case IS_NULL: @@ -1493,7 +1501,11 @@ PHP_METHOD(sqlite3stmt, execute) switch (param-type) { case SQLITE_INTEGER: convert_to_long(param-parameter); +#if LONG_MAX 2147483647 + sqlite3_bind_int64(stmt_obj-stmt, param-param_number, Z_LVAL_P(param-parameter)); +#else sqlite3_bind_int(stmt_obj-stmt, param-param_number, Z_LVAL_P(param-parameter)); +#endif break; case SQLITE_FLOAT: diff --git a/ext/sqlite3/tests/bug63921-32bit.phpt b/ext/sqlite3/tests/bug63921-32bit.phpt new file mode 100644 index 000..8c1c6b9 --- /dev/null +++ b/ext/sqlite3/tests/bug63921-32bit.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #63921 sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API +--SKIPIF-- +?php +if (!extension_loaded('sqlite3')) die('skip'); +if (PHP_INT_SIZE 4) die('skip'); // skip for 64bit builds - there is another test for that +? +--FILE-- +?php +$num = PHP_INT_MAX; // 32 bits +$conn = new sqlite3(':memory:'); +$conn-query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))'); + +$stmt = $conn-prepare('insert into users (id, num) values (:id, :num)'); +$stmt-bindValue(':id', 1, SQLITE3_INTEGER); +$stmt-bindValue(':num', $num, SQLITE3_INTEGER); +$stmt-execute(); + +$stmt = $conn-query('SELECT num FROM users'); +$result = $stmt-fetchArray(); + +var_dump($num,$result[0]); + +? +--EXPECT-- +int(2147483647) +string(10) 2147483647 diff --git a/ext/sqlite3/tests/bug63921-64bit.phpt b/ext/sqlite3/tests/bug63921-64bit.phpt new file mode 100644 index 000..8e821fd --- /dev/null +++ b/ext/sqlite3/tests/bug63921-64bit.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #63921 sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API +--SKIPIF-- +?php +if (!extension_loaded('sqlite3')) die('skip'); +if (PHP_INT_SIZE 8) die('skip'); // skip for 32bit builds - there is another test for that +? +--FILE-- +?php +$num = 14313234244; // notice this exceeds 32 bits +$conn = new sqlite3(':memory:'); +$conn-query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))'); + +$stmt = $conn-prepare('insert into users (id, num) values (:id, :num)'); +$stmt-bindValue(':id', 1, SQLITE3_INTEGER); +$stmt-bindValue(':num', $num, SQLITE3_INTEGER); +$stmt-execute(); + +$stmt = $conn-query('SELECT num FROM users'); +$result = $stmt-fetchArray(); + +var_dump($num,$result[0]); + +? +--EXPECT-- +int(14313234244) +string(15) 14313234244 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit:
[PHP-CVS] com php-src: Fix bug #63916: PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite: NEWS ext/pdo_sqlite/sqlite_statement.c ext/pdo_sqlite/tests/bug_63916-2.phpt ext
Commit:1e9a3ed234af443170d9ea8280a556d85299e301 Author:Lars Strojny lstro...@php.net Mon, 14 Jan 2013 17:59:11 +0100 Parents: 99d087e5d437023c55f96dcde4b5b784bd8b0ac8 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1e9a3ed234af443170d9ea8280a556d85299e301 Log: Fix bug #63916: PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite Bugs: https://bugs.php.net/63916 Changed paths: M NEWS M ext/pdo_sqlite/sqlite_statement.c A ext/pdo_sqlite/tests/bug_63916-2.phpt A ext/pdo_sqlite/tests/bug_63916.phpt Diff: diff --git a/NEWS b/NEWS index e411ba4..26ce118 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,10 @@ PHP NEWS . Fixed bug #63921 (sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API). (srgoogleguy, Lars) +- PDO_sqlite: + . Fixed bug #63916 (PDO::PARAM_INT casts to 32bit int internally even +on 64bit builds in pdo_sqlite). (srgoogleguy, Lars) + ?? ??? 2012, PHP 5.4.11 - Core: diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index d5b4df1..e970ad3 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -112,9 +112,15 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d } } else { convert_to_long(param-parameter); +#if LONG_MAX 2147483647 + if (SQLITE_OK == sqlite3_bind_int64(S-stmt, param-paramno + 1, Z_LVAL_P(param-parameter))) { + return 1; + } +#else if (SQLITE_OK == sqlite3_bind_int(S-stmt, param-paramno + 1, Z_LVAL_P(param-parameter))) { return 1; } +#endif } pdo_sqlite_error_stmt(stmt); return 0; diff --git a/ext/pdo_sqlite/tests/bug_63916-2.phpt b/ext/pdo_sqlite/tests/bug_63916-2.phpt new file mode 100644 index 000..bc9bfc9 --- /dev/null +++ b/ext/pdo_sqlite/tests/bug_63916-2.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite +--SKIPIF-- +?php +if (!extension_loaded('pdo_sqlite')) die('skip'); +if (PHP_INT_SIZE 4) die('skip'); +? +--FILE-- +?php +$num = PHP_INT_MAX; // 32 bits +$conn = new PDO('sqlite::memory:'); +$conn-query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))'); + +$stmt = $conn-prepare('insert into users (id, num) values (:id, :num)'); +$stmt-bindValue(':id', 1, PDO::PARAM_INT); +$stmt-bindValue(':num', $num, PDO::PARAM_INT); +$stmt-execute(); + +$stmt = $conn-query('SELECT num FROM users'); +$result = $stmt-fetchAll(PDO::FETCH_COLUMN); + +var_dump($num,$result[0]); + +? +--EXPECT-- +int(2147483647) +string(10) 2147483647 diff --git a/ext/pdo_sqlite/tests/bug_63916.phpt b/ext/pdo_sqlite/tests/bug_63916.phpt new file mode 100644 index 000..582413d --- /dev/null +++ b/ext/pdo_sqlite/tests/bug_63916.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite +--SKIPIF-- +?php +if (!extension_loaded('pdo_sqlite')) die('skip'); +if (PHP_INT_SIZE 8) die('skip'); +? +--FILE-- +?php +$num = 14313234244; // exceeds 32 bits +$conn = new PDO('sqlite::memory:'); +$conn-query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))'); + +$stmt = $conn-prepare('insert into users (id, num) values (:id, :num)'); +$stmt-bindValue(':id', 1, PDO::PARAM_INT); +$stmt-bindValue(':num', $num, PDO::PARAM_INT); +$stmt-execute(); + +$stmt = $conn-query('SELECT num FROM users'); +$result = $stmt-fetchAll(PDO::FETCH_COLUMN); + +var_dump($num,$result[0]); + +? +--EXPECT-- +int(14313234244) +string(15) 14313234244 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Support BITMAPV5HEADER in getimagesize(): https://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.28bitmap_information_header.29: NEWS ext/standard/image.c ext/standard/tests/
Commit:bf9ad4e661be4f3eebe3511887e10e521cce7f93 Author:Lars Strojny lstro...@php.net Mon, 14 Jan 2013 18:52:38 +0100 Parents: 1e9a3ed234af443170d9ea8280a556d85299e301 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bf9ad4e661be4f3eebe3511887e10e521cce7f93 Log: Support BITMAPV5HEADER in getimagesize(): https://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.28bitmap_information_header.29 Changed paths: M NEWS M ext/standard/image.c M ext/standard/tests/image/getimagesize.phpt M ext/standard/tests/image/image_type_to_mime_type.phpt A ext/standard/tests/image/test1bpix.bmp Diff: diff --git a/NEWS b/NEWS index 26ce118..16c0771 100644 --- a/NEWS +++ b/NEWS @@ -3,11 +3,12 @@ PHP NEWS ?? ??? 2012, PHP 5.4.12 - Core: - . Fixed bug #63982 (isset() inconsistently produces a fatal error on + . Fixed bug #63982 (isset() inconsistently produces a fatal error on protected property). (Stas) . Fixed bug #63943 (Bad warning text from strpos() on empty needle). (Laruence) . Fixed bug #63882 (zend_std_compare_objects crash on recursion). (Dmitry) + . Support BITMAPV5HEADER in getimagesize(). (AsamK, Lars) - Litespeed: . Fixed bug #63228 (-Werror=format-security error in lsapi code). (George) @@ -26,7 +27,7 @@ PHP NEWS . Fixed bug #63899 (Use after scope error in zend_compile). (Laruence) . Fixed bug #63762 (Sigsegv when Exception::$trace is changed by user). (Johannes) - . Fixed bug #43177 (Errors in eval()'ed code produce status code 500). + . Fixed bug #43177 (Errors in eval()'ed code produce status code 500). (Todd Ruth, Stas). - Filter: diff --git a/ext/standard/image.c b/ext/standard/image.c index ebf894a..4984e40 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -159,7 +159,7 @@ static struct gfxinfo *php_handle_bmp (php_stream * stream TSRMLS_DC) result-width= (((unsigned int)dim[ 5]) 8) + ((unsigned int) dim[ 4]); result-height = (((unsigned int)dim[ 7]) 8) + ((unsigned int) dim[ 6]); result-bits = ((unsigned int)dim[11]); - } else if (size 12 (size = 64 || size == 108)) { + } else if (size 12 (size = 64 || size == 108 || size == 124)) { result = (struct gfxinfo *) ecalloc (1, sizeof(struct gfxinfo)); result-width= (((unsigned int)dim[ 7]) 24) + (((unsigned int)dim[ 6]) 16) + (((unsigned int)dim[ 5]) 8) + ((unsigned int) dim[ 4]); result-height = (((unsigned int)dim[11]) 24) + (((unsigned int)dim[10]) 16) + (((unsigned int)dim[ 9]) 8) + ((unsigned int) dim[ 8]); diff --git a/ext/standard/tests/image/getimagesize.phpt b/ext/standard/tests/image/getimagesize.phpt index ab79c9c..6cd8275 100644 --- a/ext/standard/tests/image/getimagesize.phpt +++ b/ext/standard/tests/image/getimagesize.phpt @@ -23,7 +23,22 @@ GetImageSize() var_dump($result); ? --EXPECT-- -array(11) { +array(12) { + [test1bpix.bmp]= + array(6) { +[0]= +int(500) +[1]= +int(345) +[2]= +int(6) +[3]= +string(24) width=500 height=345 +[bits]= +int(32) +[mime]= +string(14) image/x-ms-bmp + } [test1pix.bmp]= array(6) { [0]= diff --git a/ext/standard/tests/image/image_type_to_mime_type.phpt b/ext/standard/tests/image/image_type_to_mime_type.phpt index 5d94a6f..d83ab8d 100644 --- a/ext/standard/tests/image/image_type_to_mime_type.phpt +++ b/ext/standard/tests/image/image_type_to_mime_type.phpt @@ -1,8 +1,8 @@ --TEST-- image_type_to_mime_type() --SKIPIF-- -?php - if (!function_exists('image_type_to_mime_type')) die('skip image_type_to_mime_type() not available'); +?php + if (!function_exists('image_type_to_mime_type')) die('skip image_type_to_mime_type() not available'); require_once('skipif_imagetype.inc'); ? --FILE-- @@ -25,7 +25,9 @@ image_type_to_mime_type() var_dump($result); ? --EXPECT-- -array(11) { +array(12) { + [test1bpix.bmp]= + string(14) image/x-ms-bmp [test1pix.bmp]= string(14) image/x-ms-bmp [test1pix.jp2]= @@ -48,4 +50,4 @@ array(11) { string(29) application/x-shockwave-flash [test4pix.tif]= string(10) image/tiff -} \ No newline at end of file +} diff --git a/ext/standard/tests/image/test1bpix.bmp b/ext/standard/tests/image/test1bpix.bmp new file mode 100644 index 000..5522e50 Binary files /dev/null and b/ext/standard/tests/image/test1bpix.bmp differ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Bug #46408: Fix double formatting for PostgreSQL bound parameters: NEWS Zend/zend_operators.c Zend/zend_operators.h ext/pgsql/pgsql.c ext/pgsql/tests/bug46408.phpt
Commit:92965b033afa098945d18080203de1595084d1ac Author:Lars Strojny lstro...@php.net Mon, 14 Jan 2013 21:23:52 +0100 Parents: 785e66adb536d40a26e4813e6b4ad96b2fdbef43 Branches: PHP-5.5 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=92965b033afa098945d18080203de1595084d1ac Log: Bug #46408: Fix double formatting for PostgreSQL bound parameters Bugs: https://bugs.php.net/46408 Changed paths: M NEWS M Zend/zend_operators.c M Zend/zend_operators.h M ext/pgsql/pgsql.c A ext/pgsql/tests/bug46408.phpt Diff: diff --git a/NEWS b/NEWS index c31365e..74c1134 100644 --- a/NEWS +++ b/NEWS @@ -19,12 +19,16 @@ PHP NEWS - cURL: . Added new functions curl_escape, curl_multi_setopt, curl_multi_strerror -curl_pause, curl_reset, curl_share_close, curl_share_init, +curl_pause, curl_reset, curl_share_close, curl_share_init, curl_share_setopt curl_strerror and curl_unescape. (Pierrick) . Addes new curl options CURLOPT_TELNETOPTIONS, CURLOPT_GSSAPI_DELEGATION, CURLOPT_ACCEPTTIMEOUT_MS, CURLOPT_SSL_OPTIONS, CURLOPT_TCP_KEEPALIVE, CURLOPT_TCP_KEEPIDLE and CURLOPT_TCP_KEEPINTVL. (Pierrick) +- pgsql: + . Bug #46408: Locale number format settings can cause pg_query_params to +break with numerics. (asmecher, Lars) + 18 Dec 2012, PHP 5.5.0 Alpha 2 - General improvements: diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index bd9..274893c 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -572,6 +572,24 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ } /* }}} */ +ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */ +{ + double dval; + switch (Z_TYPE_P(op)) { + case IS_DOUBLE: { + TSRMLS_FETCH(); + dval = Z_DVAL_P(op); + Z_STRLEN_P(op) = zend_spprintf(Z_STRVAL_P(op), 0, %.*H, (int) EG(precision), dval); + /* %H already handles removing trailing zeros from the fractional part, yay */ + break; + } + default: + return _convert_to_string(op); + } + Z_TYPE_P(op) = IS_STRING; +} +/* }}} */ + ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ { long lval; diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index d3f5e5a..20a5277 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -301,6 +301,7 @@ ZEND_API int increment_function(zval *op1); ZEND_API int decrement_function(zval *op2); ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC); +ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC); ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC); ZEND_API void convert_to_long(zval *op); ZEND_API void convert_to_double(zval *op); @@ -314,6 +315,7 @@ ZEND_API void multi_convert_to_double_ex(int argc, ...); ZEND_API void multi_convert_to_string_ex(int argc, ...); ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2); ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2); +#define convert_to_cstring(op) if ((op)-type != IS_STRING) { _convert_to_cstring((op) ZEND_FILE_LINE_CC); } #define convert_to_string(op) if ((op)-type != IS_STRING) { _convert_to_string((op) ZEND_FILE_LINE_CC); } ZEND_API double zend_string_to_double(const char *number, zend_uint length); diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index d01dda6..7ee838a 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1736,7 +1736,7 @@ PHP_FUNCTION(pg_query_params) } else { zval tmp_val = **tmp; zval_copy_ctor(tmp_val); - convert_to_string(tmp_val); + convert_to_cstring(tmp_val); if (Z_TYPE(tmp_val) != IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING,Error converting parameter); zval_dtor(tmp_val); diff --git a/ext/pgsql/tests/bug46408.phpt b/ext/pgsql/tests/bug46408.phpt new file mode 100644 index 000..8c72ba5 --- /dev/null +++ b/ext/pgsql/tests/bug46408.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #46408 (Locale number format settings can cause pg_query_params to break with numerics) +--SKIPIF-- +?php +require_once('skipif.inc'); +? +--FILE-- +?php + +require_once('config.inc'); + +$dbh = pg_connect($conn_str); +setlocale(LC_ALL, 'hr_HR.utf-8', 'hr_HR'); +echo 3.5.PHP_EOL; +pg_query_params(SELECT $1::numeric, array(3.5)); +pg_close($dbh); + +echo Done.PHP_EOL; + +? +--EXPECTF-- +3,5 +Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Bug #52958: Segfault in PDO_OCI on cleanup after running a long testsuite.: NEWS ext/pdo_oci/oci_driver.c
Commit:6a065876b9212404daaf8fee1708834da83dac56 Author:Lars Strojny lstro...@php.net Mon, 14 Jan 2013 21:35:48 +0100 Parents: bf9ad4e661be4f3eebe3511887e10e521cce7f93 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6a065876b9212404daaf8fee1708834da83dac56 Log: Bug #52958: Segfault in PDO_OCI on cleanup after running a long testsuite. Bugs: https://bugs.php.net/52958 Changed paths: M NEWS M ext/pdo_oci/oci_driver.c Diff: diff --git a/NEWS b/NEWS index 16c0771..58a50bb 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,8 @@ PHP NEWS - PDO_sqlite: . Fixed bug #63916 (PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite). (srgoogleguy, Lars) + . Fixed bug #52958 (Segfault in PDO_OCI on cleanup after running a long +testsuite) (hswong3i, Lars) ?? ??? 2012, PHP 5.4.11 diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index a0377dd..5497beb 100644 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -227,8 +227,10 @@ static int oci_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ H-server = NULL; } - OCIHandleFree(H-err, OCI_HTYPE_ERROR); - H-err = NULL; + if (H-err) { + OCIHandleFree(H-err, OCI_HTYPE_ERROR); + H-err = NULL; + } if (H-charset H-env) { OCIHandleFree(H-env, OCI_HTYPE_ENV); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Added NEWS item for DateTimeImmutable: NEWS
Commit:6313fc7e10d4234cc1e80f223c0652240cad4fda Author:Derick Rethans git...@derickrethans.nl Mon, 14 Jan 2013 20:36:48 + Parents: c20911a8501ed2a69c6ce9359e8e50d599f99bba Branches: PHP-5.5 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6313fc7e10d4234cc1e80f223c0652240cad4fda Log: Added NEWS item for DateTimeImmutable Changed paths: M NEWS Diff: diff --git a/NEWS b/NEWS index 74c1134..9e8cd85 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,10 @@ PHP NEWS CURLOPT_ACCEPTTIMEOUT_MS, CURLOPT_SSL_OPTIONS, CURLOPT_TCP_KEEPALIVE, CURLOPT_TCP_KEEPIDLE and CURLOPT_TCP_KEEPINTVL. (Pierrick) +- DateTime + . Added DateTimeImmutable - a variant of DateTime that only returns the +modified state instead of changing itself. (Derick) + - pgsql: . Bug #46408: Locale number format settings can cause pg_query_params to break with numerics. (asmecher, Lars) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Make DatePeriod support DateTimeImmutable as well.: ext/date/php_date.c ext/date/php_date.h ext/date/tests/date_period-immutable.phpt
Commit:c20911a8501ed2a69c6ce9359e8e50d599f99bba Author:Derick Rethans git...@derickrethans.nl Thu, 20 Dec 2012 13:22:18 + Parents: a0618139c9f7aa7859f338a485af161f672be9cd Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c20911a8501ed2a69c6ce9359e8e50d599f99bba Log: Make DatePeriod support DateTimeImmutable as well. If the start element is a DateTimeImmutable object, then all returned objects are also DateTimeImmutable objects. If the start element is a DateTime object, then all returned objects are DateTime objects. Changed paths: M ext/date/php_date.c M ext/date/php_date.h A ext/date/tests/date_period-immutable.phpt Diff: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index fc281ce..cc83130 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1847,7 +1847,7 @@ static void date_period_it_current_data(zend_object_iterator *iter, zval ***data /* Create new object */ MAKE_STD_ZVAL(iterator-current); - php_date_instantiate(date_ce_date, iterator-current TSRMLS_CC); + php_date_instantiate(object-start_ce, iterator-current TSRMLS_CC); newdateobj = (php_date_obj *) zend_object_store_get_object(iterator-current TSRMLS_CC); newdateobj-time = timelib_time_ctor(); *newdateobj-time = *it_time; @@ -4182,6 +4182,7 @@ PHP_METHOD(DatePeriod, __construct) if (dpobj-end) { timelib_update_ts(dpobj-end, NULL); } + dpobj-start_ce = date_ce_date; } else { /* init */ intobj = (php_interval_obj *) zend_object_store_get_object(interval TSRMLS_CC); @@ -4197,6 +4198,7 @@ PHP_METHOD(DatePeriod, __construct) clone-tz_info = dateobj-time-tz_info; } dpobj-start = clone; + dpobj-start_ce = Z_OBJCE_P(start); /* interval */ dpobj-interval = timelib_rel_time_clone(intobj-diff); diff --git a/ext/date/php_date.h b/ext/date/php_date.h index 19c692b..3af3fa4 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -154,6 +154,7 @@ struct _php_interval_obj { struct _php_period_obj { zend_object std; timelib_time *start; + zend_class_entry *start_ce; timelib_time *current; timelib_time *end; timelib_rel_time *interval; diff --git a/ext/date/tests/date_period-immutable.phpt b/ext/date/tests/date_period-immutable.phpt new file mode 100644 index 000..0ec4b4a --- /dev/null +++ b/ext/date/tests/date_period-immutable.phpt @@ -0,0 +1,56 @@ +--TEST-- +DatePeriod +--FILE-- +?php +date_default_timezone_set('UTC'); +$db1 = new DateTimeImmutable( '2008-01-01' ); +$db2 = new DateTime( '2008-01-01' ); +$de = new DateTime( '2008-03-31' ); +$di = DateInterval::createFromDateString( 'first day of next month' ); + +foreach ( new DatePeriod( $db1, $di, $de ) as $dt ) +{ + echo get_class( $dt ), \n; + echo $dt-format( l Y-m-d\n ); +echo $dt-modify( 3 tuesday )-format( l Y-m-d\n ); + echo $dt-format( l Y-m-d\n\n ); +} + +foreach ( new DatePeriod( $db2, $di, $de ) as $dt ) +{ + echo get_class( $dt ), \n; + echo $dt-format( l Y-m-d\n ); +echo $dt-modify( 3 tuesday )-format( l Y-m-d\n ); + echo $dt-format( l Y-m-d\n\n ); +} +? +--EXPECT-- +DateTimeImmutable +Tuesday 2008-01-01 +Tuesday 2008-01-15 +Tuesday 2008-01-01 + +DateTimeImmutable +Friday 2008-02-01 +Tuesday 2008-02-19 +Friday 2008-02-01 + +DateTimeImmutable +Saturday 2008-03-01 +Tuesday 2008-03-18 +Saturday 2008-03-01 + +DateTime +Tuesday 2008-01-01 +Tuesday 2008-01-15 +Tuesday 2008-01-15 + +DateTime +Friday 2008-02-01 +Tuesday 2008-02-19 +Tuesday 2008-02-19 + +DateTime +Saturday 2008-03-01 +Tuesday 2008-03-18 +Tuesday 2008-03-18 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed crash bug when the non-OO interface was used.: ext/date/php_date.c
Commit:a0618139c9f7aa7859f338a485af161f672be9cd Author:Derick Rethans git...@derickrethans.nl Wed, 19 Dec 2012 17:40:14 + Parents: 017b1f7fca09896b05f2602136ffba7585cd4bfe Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a0618139c9f7aa7859f338a485af161f672be9cd Log: Fixed crash bug when the non-OO interface was used. Changed paths: M ext/date/php_date.c Diff: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 596a7a9..fc281ce 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2954,7 +2954,7 @@ PHP_FUNCTION(date_modify) php_date_modify(object, modify, modify_len, return_value TSRMLS_CC); - RETURN_ZVAL(getThis(), 1, 0); + RETURN_ZVAL(object, 1, 0); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Rename DateTimePoint to DateTimeImmutable.: ext/date/php_date.c ext/date/php_date.h ext/date/tests/date_time_immutable-inherited.phpt ext/date/tests/date_time_immutable.phpt ext
Commit:017b1f7fca09896b05f2602136ffba7585cd4bfe Author:Derick Rethans git...@derickrethans.nl Wed, 19 Dec 2012 16:24:38 + Parents: a0bea9a1de7123d52b0339ad9d883bbe231122d5 Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=017b1f7fca09896b05f2602136ffba7585cd4bfe Log: Rename DateTimePoint to DateTimeImmutable. Changed paths: M ext/date/php_date.c M ext/date/php_date.h A ext/date/tests/date_time_immutable-inherited.phpt A ext/date/tests/date_time_immutable.phpt D ext/date/tests/date_time_point-inherited.phpt D ext/date/tests/date_time_point.phpt diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 3fbdaf2..596a7a9 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -385,9 +385,9 @@ const zend_function_entry date_functions[] = { /* Advanced Interface */ PHP_FE(date_create, arginfo_date_create) - PHP_FE(date_create_point, arginfo_date_create) + PHP_FE(date_create_immutable, arginfo_date_create) PHP_FE(date_create_from_format, arginfo_date_create_from_format) - PHP_FE(date_create_point_from_format, arginfo_date_create_from_format) + PHP_FE(date_create_immutable_from_format, arginfo_date_create_from_format) PHP_FE(date_parse, arginfo_date_parse) PHP_FE(date_parse_from_format, arginfo_date_parse_from_format) PHP_FE(date_get_last_errors, arginfo_date_get_last_errors) @@ -452,17 +452,17 @@ const zend_function_entry date_funcs_date[] = { PHP_FE_END }; -const zend_function_entry date_funcs_point[] = { - PHP_ME(DateTimePoint, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) - PHP_ME(DateTimePoint, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME(DateTimePoint, modify,arginfo_date_method_modify, 0) - PHP_ME(DateTimePoint, add, arginfo_date_method_add, 0) - PHP_ME(DateTimePoint, sub, arginfo_date_method_sub, 0) - PHP_ME(DateTimePoint, setTimezone, arginfo_date_method_timezone_set, 0) - PHP_ME(DateTimePoint, setTime, arginfo_date_method_time_set, 0) - PHP_ME(DateTimePoint, setDate, arginfo_date_method_date_set, 0) - PHP_ME(DateTimePoint, setISODate,arginfo_date_method_isodate_set, 0) - PHP_ME(DateTimePoint, setTimestamp, arginfo_date_method_timestamp_set, 0) +const zend_function_entry date_funcs_immutable[] = { + PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME(DateTimeImmutable, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(DateTimeImmutable, modify,arginfo_date_method_modify, 0) + PHP_ME(DateTimeImmutable, add, arginfo_date_method_add, 0) + PHP_ME(DateTimeImmutable, sub, arginfo_date_method_sub, 0) + PHP_ME(DateTimeImmutable, setTimezone, arginfo_date_method_timezone_set, 0) + PHP_ME(DateTimeImmutable, setTime, arginfo_date_method_time_set, 0) + PHP_ME(DateTimeImmutable, setDate, arginfo_date_method_date_set, 0) + PHP_ME(DateTimeImmutable, setISODate, arginfo_date_method_isodate_set, 0) + PHP_ME(DateTimeImmutable, setTimestamp, arginfo_date_method_timestamp_set, 0) PHP_FE_END }; @@ -524,7 +524,7 @@ PHP_INI_END() /* }}} */ zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period; -zend_class_entry *date_ce_point; +zend_class_entry *date_ce_immutable; PHPAPI zend_class_entry *php_date_get_date_ce(void) @@ -532,9 +532,9 @@ PHPAPI zend_class_entry *php_date_get_date_ce(void) return date_ce_date; } -PHPAPI zend_class_entry *php_date_get_point_ce(void) +PHPAPI zend_class_entry *php_date_get_immutable_ce(void) { - return date_ce_point; + return date_ce_immutable; } PHPAPI zend_class_entry *php_date_get_timezone_ce(void) @@ -543,7 +543,7 @@ PHPAPI zend_class_entry *php_date_get_timezone_ce(void) } static zend_object_handlers date_object_handlers_date; -static zend_object_handlers date_object_handlers_point; +static zend_object_handlers date_object_handlers_immutable; static zend_object_handlers date_object_handlers_timezone; static zend_object_handlers date_object_handlers_interval; static zend_object_handlers date_object_handlers_period; @@ -578,13 +578,13 @@ static void date_object_free_storage_interval(void *object TSRMLS_DC); static void date_object_free_storage_period(void *object TSRMLS_DC); static zend_object_value date_object_new_date(zend_class_entry *class_type TSRMLS_DC); -static zend_object_value date_object_new_point(zend_class_entry *class_type TSRMLS_DC); +static zend_object_value date_object_new_immutable(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_interval(zend_class_entry *class_type
[PHP-CVS] com php-src: Added a few missing TSRMLS_DC/TSRMLS_CC.: ext/date/php_date.c
Commit:3919d0adf734f37d7db7c6d76522cd75ac608250 Author:Derick Rethans git...@derickrethans.nl Mon, 17 Dec 2012 16:49:00 + Parents: 45a429200cdf7e918ef3aabc0eb23441f6e8eda3 Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3919d0adf734f37d7db7c6d76522cd75ac608250 Log: Added a few missing TSRMLS_DC/TSRMLS_CC. Changed paths: M ext/date/php_date.c Diff: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 61f6a95..3fbdaf2 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2883,7 +2883,7 @@ PHP_FUNCTION(date_format) } /* }}} */ -static void php_date_modify(zval *object, char *modify, int modify_len, zval *return_value) +static void php_date_modify(zval *object, char *modify, int modify_len, zval *return_value TSRMLS_DC) { php_date_obj *dateobj; timelib_time *tmp_time; @@ -2952,7 +2952,7 @@ PHP_FUNCTION(date_modify) RETURN_FALSE; } - php_date_modify(object, modify, modify_len, return_value); + php_date_modify(object, modify, modify_len, return_value TSRMLS_CC); RETURN_ZVAL(getThis(), 1, 0); } @@ -2971,13 +2971,13 @@ PHP_METHOD(DateTimePoint, modify) } new_object = date_clone_point(object); - php_date_modify(new_object, modify, modify_len, return_value); + php_date_modify(new_object, modify, modify_len, return_value TSRMLS_CC); RETURN_ZVAL(new_object, 0, 1); } /* }}} */ -static void php_date_add(zval *object, zval *interval, zval *return_value) +static void php_date_add(zval *object, zval *interval, zval *return_value TSRMLS_DC) { php_date_obj *dateobj; php_interval_obj *intobj; @@ -3021,7 +3021,7 @@ PHP_FUNCTION(date_add) RETURN_FALSE; } - php_date_add(object, interval, return_value); + php_date_add(object, interval, return_value TSRMLS_CC); RETURN_ZVAL(object, 1, 0); } @@ -3038,13 +3038,13 @@ PHP_METHOD(DateTimePoint, add) } new_object = date_clone_point(object); - php_date_add(new_object, interval, return_value); + php_date_add(new_object, interval, return_value TSRMLS_CC); RETURN_ZVAL(new_object, 0, 1); } /* }}} */ -static void php_date_sub(zval *object, zval *interval, zval *return_value) +static void php_date_sub(zval *object, zval *interval, zval *return_value TSRMLS_DC) { php_date_obj *dateobj; php_interval_obj *intobj; @@ -3091,7 +3091,7 @@ PHP_FUNCTION(date_sub) RETURN_FALSE; } - php_date_sub(object, interval, return_value); + php_date_sub(object, interval, return_value TSRMLS_CC); RETURN_ZVAL(object, 1, 0); } @@ -3108,7 +3108,7 @@ PHP_METHOD(DateTimePoint, sub) } new_object = date_clone_point(object); - php_date_sub(new_object, interval, return_value); + php_date_sub(new_object, interval, return_value TSRMLS_CC); RETURN_ZVAL(new_object, 0, 1); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Added another test to test the unmodified inherited methods.: ext/date/tests/date_time_point-inherited.phpt
Commit:a0bea9a1de7123d52b0339ad9d883bbe231122d5 Author:Derick Rethans git...@derickrethans.nl Mon, 17 Dec 2012 16:49:25 + Parents: 3919d0adf734f37d7db7c6d76522cd75ac608250 Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a0bea9a1de7123d52b0339ad9d883bbe231122d5 Log: Added another test to test the unmodified inherited methods. Changed paths: A ext/date/tests/date_time_point-inherited.phpt Diff: diff --git a/ext/date/tests/date_time_point-inherited.phpt b/ext/date/tests/date_time_point-inherited.phpt new file mode 100644 index 000..e355407 --- /dev/null +++ b/ext/date/tests/date_time_point-inherited.phpt @@ -0,0 +1,25 @@ +--TEST-- +Tests for DateTimePoint. +--INI-- +date.timezone=Europe/London +--FILE-- +?php +$tz = new DateTimeZone(Asia/Tokyo); +$current = 2012-12-27 16:24:08; + +echo \ngetTimezone():\n; +$v = date_create_point($current); +$x = $v-getTimezone(); +var_dump($x-getName()); + +echo \ngetTimestamp():\n; +$v = date_create_point($current); +$x = $v-getTimestamp(); +var_dump($x); +? +--EXPECT-- +getTimezone(): +string(13) Europe/London + +getTimestamp(): +int(1356625448) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Added a test case for DateTimePoint.: ext/date/tests/date_time_point.phpt
Commit:45a429200cdf7e918ef3aabc0eb23441f6e8eda3 Author:Derick Rethans git...@derickrethans.nl Mon, 17 Dec 2012 16:35:52 + Parents: 1cc61f09279b26b9acc82461c7b77051355346ad Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=45a429200cdf7e918ef3aabc0eb23441f6e8eda3 Log: Added a test case for DateTimePoint. Changed paths: A ext/date/tests/date_time_point.phpt Diff: diff --git a/ext/date/tests/date_time_point.phpt b/ext/date/tests/date_time_point.phpt new file mode 100644 index 000..810eeca --- /dev/null +++ b/ext/date/tests/date_time_point.phpt @@ -0,0 +1,167 @@ +--TEST-- +Tests for DateTimePoint. +--INI-- +date.timezone=Europe/London +--FILE-- +?php +$tz = new DateTimeZone(Asia/Tokyo); +$current = 2012-12-27 16:24:08; + +function dump($a, $b, $c) +{ + echo 'orig:', $a-format('Y-m-d H:i:s e'), \n; + echo 'copy:', $b-format('Y-m-d H:i:s e'), \n; + echo 'changed: ', $c-format('Y-m-d H:i:s e'), \n; +} + +echo modify():\n; +$v = date_create_point($current); +$z = $v; +$x = $z-modify(+2 days); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z-modify(+2 days); +dump($v, $z, $x); + +echo \nadd():\n; +$v = date_create_point($current); +$z = $v; +$x = $z-add(new DateInterval(P2DT2S)); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z-add(new DateInterval(P2DT2S)); +dump($v, $z, $x); + +echo \nsub():\n; +$v = date_create_point($current); +$z = $v; +$x = $z-sub(new DateInterval(P2DT2S)); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z-sub(new DateInterval(P2DT2S)); +dump($v, $z, $x); + +echo \nsetTimezone():\n; +$v = date_create_point($current); +$z = $v; +$x = $z-setTimezone($tz); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z-setTimezone($tz); +dump($v, $z, $x); +$v = new DateTimePoint($current); +$z = $v; +$x = $z-setTimezone($tz); +dump($v, $z, $x); + +echo \nsetTime():\n; +$v = date_create_point($current); +$z = $v; +$x = $z-setTime(5, 7, 19); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z-setTime(5, 7, 19); +dump($v, $z, $x); + +echo \nsetDate():\n; +$v = date_create_point($current); +$z = $v; +$x = $z-setDate(5, 7, 19); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z-setDate(5, 7, 19); +dump($v, $z, $x); + +echo \nsetIsoDate():\n; +$v = date_create_point($current); +$z = $v; +$x = $z-setIsoDate(2012, 2, 6); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z-setIsoDate(2012, 2, 6); +dump($v, $z, $x); + +echo \nsetTimestamp():\n; +$v = date_create_point($current); +$z = $v; +$x = $z-setTimestamp(2012234222); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z-setTimestamp(2012234222); +dump($v, $z, $x); +? +--EXPECT-- +modify(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-29 16:24:08 Europe/London +orig:2012-12-29 16:24:08 Europe/London +copy:2012-12-29 16:24:08 Europe/London +changed: 2012-12-29 16:24:08 Europe/London + +add(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-29 16:24:10 Europe/London +orig:2012-12-29 16:24:10 Europe/London +copy:2012-12-29 16:24:10 Europe/London +changed: 2012-12-29 16:24:10 Europe/London + +sub(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-25 16:24:06 Europe/London +orig:2012-12-25 16:24:06 Europe/London +copy:2012-12-25 16:24:06 Europe/London +changed: 2012-12-25 16:24:06 Europe/London + +setTimezone(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-28 01:24:08 Asia/Tokyo +orig:2012-12-28 01:24:08 Asia/Tokyo +copy:2012-12-28 01:24:08 Asia/Tokyo +changed: 2012-12-28 01:24:08 Asia/Tokyo +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-28 01:24:08 Asia/Tokyo + +setTime(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-27 05:07:19 Europe/London +orig:2012-12-27 05:07:19 Europe/London +copy:2012-12-27 05:07:19 Europe/London +changed: 2012-12-27 05:07:19 Europe/London + +setDate(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 0005-07-19 16:24:08 Europe/London +orig:0005-07-19 16:24:08 Europe/London +copy:0005-07-19 16:24:08 Europe/London +changed: 0005-07-19 16:24:08 Europe/London + +setIsoDate(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-01-14 16:24:08 Europe/London +orig:2012-01-14 16:24:08 Europe/London +copy:2012-01-14 16:24:08 Europe/London +changed: 2012-01-14 16:24:08 Europe/London + +setTimestamp(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2033-10-06 18:57:02
[PHP-CVS] com php-src: Implemented immutable DateTime objects as the DateTimePoint class.: ext/date/php_date.c ext/date/php_date.h
Commit:1cc61f09279b26b9acc82461c7b77051355346ad Author:Derick Rethans git...@derickrethans.nl Mon, 17 Dec 2012 15:31:23 + Parents: 92965b033afa098945d18080203de1595084d1ac Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1cc61f09279b26b9acc82461c7b77051355346ad Log: Implemented immutable DateTime objects as the DateTimePoint class. Changed paths: M ext/date/php_date.c M ext/date/php_date.h diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 0394cb6..61f6a95 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -385,7 +385,9 @@ const zend_function_entry date_functions[] = { /* Advanced Interface */ PHP_FE(date_create, arginfo_date_create) + PHP_FE(date_create_point, arginfo_date_create) PHP_FE(date_create_from_format, arginfo_date_create_from_format) + PHP_FE(date_create_point_from_format, arginfo_date_create_from_format) PHP_FE(date_parse, arginfo_date_parse) PHP_FE(date_parse_from_format, arginfo_date_parse_from_format) PHP_FE(date_get_last_errors, arginfo_date_get_last_errors) @@ -450,6 +452,20 @@ const zend_function_entry date_funcs_date[] = { PHP_FE_END }; +const zend_function_entry date_funcs_point[] = { + PHP_ME(DateTimePoint, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME(DateTimePoint, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(DateTimePoint, modify,arginfo_date_method_modify, 0) + PHP_ME(DateTimePoint, add, arginfo_date_method_add, 0) + PHP_ME(DateTimePoint, sub, arginfo_date_method_sub, 0) + PHP_ME(DateTimePoint, setTimezone, arginfo_date_method_timezone_set, 0) + PHP_ME(DateTimePoint, setTime, arginfo_date_method_time_set, 0) + PHP_ME(DateTimePoint, setDate, arginfo_date_method_date_set, 0) + PHP_ME(DateTimePoint, setISODate,arginfo_date_method_isodate_set, 0) + PHP_ME(DateTimePoint, setTimestamp, arginfo_date_method_timestamp_set, 0) + PHP_FE_END +}; + const zend_function_entry date_funcs_timezone[] = { PHP_ME(DateTimeZone, __construct, arginfo_timezone_open, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getName, timezone_name_get, arginfo_timezone_method_name_get, 0) @@ -508,6 +524,7 @@ PHP_INI_END() /* }}} */ zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period; +zend_class_entry *date_ce_point; PHPAPI zend_class_entry *php_date_get_date_ce(void) @@ -515,12 +532,18 @@ PHPAPI zend_class_entry *php_date_get_date_ce(void) return date_ce_date; } +PHPAPI zend_class_entry *php_date_get_point_ce(void) +{ + return date_ce_point; +} + PHPAPI zend_class_entry *php_date_get_timezone_ce(void) { return date_ce_timezone; } static zend_object_handlers date_object_handlers_date; +static zend_object_handlers date_object_handlers_point; static zend_object_handlers date_object_handlers_timezone; static zend_object_handlers date_object_handlers_interval; static zend_object_handlers date_object_handlers_period; @@ -555,11 +578,13 @@ static void date_object_free_storage_interval(void *object TSRMLS_DC); static void date_object_free_storage_period(void *object TSRMLS_DC); static zend_object_value date_object_new_date(zend_class_entry *class_type TSRMLS_DC); +static zend_object_value date_object_new_point(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_interval(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_period(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC); +static zend_object_value date_object_clone_point(zval *this_ptr TSRMLS_DC); static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC); static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC); static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC); @@ -1908,7 +1933,7 @@ zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval static void date_register_classes(TSRMLS_D) { - zend_class_entry ce_date, ce_timezone, ce_interval, ce_period; + zend_class_entry ce_date, ce_point, ce_timezone, ce_interval, ce_period; INIT_CLASS_ENTRY(ce_date, DateTime, date_funcs_date); ce_date.create_object = date_object_new_date; @@ -1934,6 +1959,13 @@ static void date_register_classes(TSRMLS_D) REGISTER_DATE_CLASS_CONST_STRING(RSS, DATE_FORMAT_RFC1123); REGISTER_DATE_CLASS_CONST_STRING(W3C, DATE_FORMAT_RFC3339); + INIT_CLASS_ENTRY(ce_point, DateTimePoint, date_funcs_point); + ce_point.create_object =
Re: [PHP-CVS] com php-src: Bug #46408: Fix double formatting for PostgreSQL bound parameters: NEWS Zend/zend_operators.c Zend/zend_operators.h ext/pgsql/pgsql.c ext/pgsql/tests/bug46408.phpt
On 15 January 2013 04:23, Lars Strojny lstro...@php.net wrote: diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index bd9..274893c 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -572,6 +572,24 @@ ZEND_API void convert_to_boolean(zval *op) /* {{{ */ } /* }}} */ +ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */ +{ + double dval; + switch (Z_TYPE_P(op)) { + case IS_DOUBLE: { + TSRMLS_FETCH(); + dval = Z_DVAL_P(op); + Z_STRLEN_P(op) = zend_spprintf(Z_STRVAL_P(op), 0, %.*H, (int) EG(precision), dval); + /* %H already handles removing trailing zeros from the fractional part, yay */ + break; + } + default: + return _convert_to_string(op); + } + Z_TYPE_P(op) = IS_STRING; +} +/* }}} */ + ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ { long lval; This broke compilation — specifically, the default: code path. I've opened https://github.com/php/php-src/pull/261 to fix this, if someone with Zend karma would be so kind. Thanks, Adam -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fix compile failure introduced by the fix for bug #46408.: Zend/zend_operators.c
Commit:be1700d467a6875415c292f95040965fb359493c Author:Adam Harvey ahar...@php.net Tue, 15 Jan 2013 10:08:26 +0800 Parents: 3ea2b73a30885c8fe308b7103442373cbb8d1543 Branches: PHP-5.5 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be1700d467a6875415c292f95040965fb359493c Log: Fix compile failure introduced by the fix for bug #46408. Bugs: https://bugs.php.net/46408 Changed paths: M Zend/zend_operators.c Diff: diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 274893c..c8b868d 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -584,7 +584,7 @@ ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC) /* {{{ */ break; } default: - return _convert_to_string(op); + _convert_to_string(op ZEND_FILE_LINE_CC); } Z_TYPE_P(op) = IS_STRING; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Update fputcsv() to escape all characters equally.: NEWS ext/standard/file.c ext/standard/tests/file/fputcsv.phpt ext/standard/tests/file/fputcsv_bug43225.phpt
Commit:9b5cb0e8059b1e8bec096067491ed8d75f878938 Author:Adam Harvey ahar...@php.net Tue, 15 Jan 2013 15:17:45 +0800 Parents: e1410b5a70543856de3978603b41fbf2ca5d330c Branches: PHP-5.3 PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9b5cb0e8059b1e8bec096067491ed8d75f878938 Log: Update fputcsv() to escape all characters equally. At present, backslashes have special case handling within fputcsv(): when one is encountered within a field that's being escaped, escaping stops until the next instance of the enclosure character is hit. This can result in malformed CSV. Fixes bug #43225 (fputcsv incorrectly handles cells ending in \ followed by ). Bugs: https://bugs.php.net/43225 Changed paths: M NEWS M ext/standard/file.c M ext/standard/tests/file/fputcsv.phpt A ext/standard/tests/file/fputcsv_bug43225.phpt Diff: diff --git a/NEWS b/NEWS index e78af23..a7c2fa4 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ PHP NEWS - Core . Fixed bug #63943 (Bad warning text from strpos() on empty needle). (Laruence) + . Fixed bug #43225 (fputcsv incorrectly handles cells ending in \ followed +by ). (Adam) - cURL extension: . Fixed bug (segfault due to libcurl connection caching). (Pierrick) diff --git a/ext/standard/file.c b/ext/standard/file.c index 8b18155..fa85bf1 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1953,7 +1953,6 @@ PHP_FUNCTION(fputcsv) { char delimiter = ','; /* allow this to be set as parameter */ char enclosure = ''; /* allow this to be set as parameter */ - const char escape_char = '\\'; php_stream *stream; int ret; zval *fp = NULL, *fields = NULL, **field_tmp = NULL, field; @@ -2008,24 +2007,19 @@ PHP_FUNCTION(fputcsv) /* enclose a field that contains a delimiter, an enclosure character, or a newline */ if (FPUTCSV_FLD_CHK(delimiter) || FPUTCSV_FLD_CHK(enclosure) || - FPUTCSV_FLD_CHK(escape_char) || FPUTCSV_FLD_CHK('\n') || FPUTCSV_FLD_CHK('\r') || FPUTCSV_FLD_CHK('\t') || + FPUTCSV_FLD_CHK('\\') || FPUTCSV_FLD_CHK(' ') ) { char *ch = Z_STRVAL(field); char *end = ch + Z_STRLEN(field); - int escaped = 0; smart_str_appendc(csvline, enclosure); while (ch end) { - if (*ch == escape_char) { - escaped = 1; - } else if (!escaped *ch == enclosure) { + if (*ch == enclosure) { smart_str_appendc(csvline, enclosure); - } else { - escaped = 0; } smart_str_appendc(csvline, *ch); ch++; diff --git a/ext/standard/tests/file/fputcsv.phpt b/ext/standard/tests/file/fputcsv.phpt index 63c4150..d71f777 100644 --- a/ext/standard/tests/file/fputcsv.phpt +++ b/ext/standard/tests/file/fputcsv.phpt @@ -44,7 +44,7 @@ echo '$list = ';var_export($res);echo ;\n; $fp = fopen($file, r); $res = array(); -while($l=fgetcsv($fp)) +while($l=fgetcsv($fp, 0, ',', '', '')) { $res[] = join(',',$l); } @@ -75,10 +75,10 @@ $list = array ( 13 = 'aaa,bbb ', 14 = 'aa,bb', 15 = 'aa,bbb', - 16 = 'aaa,\\bbb,ccc', - 17 = 'aaa\\a,bbb', - 18 = '\\,aaa', - 19 = '\\,aaa', + 16 = 'aaa,\\bbb,ccc', + 17 = 'aaa\\a,bbb', + 18 = '\\,aaa', + 19 = '\\,aaa', ); $list = array ( 0 = 'aaa,bbb', diff --git a/ext/standard/tests/file/fputcsv_bug43225.phpt b/ext/standard/tests/file/fputcsv_bug43225.phpt new file mode 100644 index 000..1de3b5f --- /dev/null +++ b/ext/standard/tests/file/fputcsv_bug43225.phpt @@ -0,0 +1,20 @@ +--TEST-- +fputcsv(): bug #43225 (fputcsv incorrectly handles cells ending in \ followed by ) +--FILE-- +?php + +$row = array( +'a\\', +'bbb', +); + +$file = dirname(__FILE__) . 'fgetcsv_bug43225.csv'; +$fp = fopen($file, 'w'); +fputcsv($fp, $row); +fclose($fp); +readfile($file); +unlink($file); + +? +--EXPECT-- +a\,bbb -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: NEWS ext/standard/file.c
Commit:a4191b0aad94fb7bebb8fd5c4233006849845c31 Author:Adam Harvey ahar...@php.net Tue, 15 Jan 2013 15:24:21 +0800 Parents: 6a065876b9212404daaf8fee1708834da83dac56 9b5cb0e8059b1e8bec096067491ed8d75f878938 Branches: PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a4191b0aad94fb7bebb8fd5c4233006849845c31 Log: Merge branch 'PHP-5.3' into PHP-5.4 * PHP-5.3: Update fputcsv() to escape all characters equally. Changed paths: MM NEWS MM ext/standard/file.c Diff: diff --cc NEWS index 58a50bb,a7c2fa4..14ee211 --- a/NEWS +++ b/NEWS @@@ -1,31 -1,10 +1,33 @@@ PHP NEWS ||| -?? ??? 2013, PHP 5.3.23 +?? ??? 2012, PHP 5.4.12 -?? ??? 2013, PHP 5.3.22 +- Core: + . Fixed bug #63982 (isset() inconsistently produces a fatal error on +protected property). (Stas) + . Fixed bug #63943 (Bad warning text from strpos() on empty needle). +(Laruence) + . Fixed bug #63882 (zend_std_compare_objects crash on recursion). (Dmitry) ++ . Fixed bug #43225 (fputcsv incorrectly handles cells ending in \ followed ++by ). (Adam) + . Support BITMAPV5HEADER in getimagesize(). (AsamK, Lars) -- Zend Engine: +- Litespeed: + . Fixed bug #63228 (-Werror=format-security error in lsapi code). (George) + +- ext/sqlite3: + . Fixed bug #63921 (sqlite3::bindvalue and relative PHP functions aren't +using sqlite3_*_int64 API). (srgoogleguy, Lars) + +- PDO_sqlite: + . Fixed bug #63916 (PDO::PARAM_INT casts to 32bit int internally even +on 64bit builds in pdo_sqlite). (srgoogleguy, Lars) + . Fixed bug #52958 (Segfault in PDO_OCI on cleanup after running a long +testsuite) (hswong3i, Lars) + +?? ??? 2012, PHP 5.4.11 + +- Core: . Fixed bug #63899 (Use after scope error in zend_compile). (Laruence) . Fixed bug #63762 (Sigsegv when Exception::$trace is changed by user). (Johannes) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/standard/file.c
Commit:ba329707101208db330acd3b07b96f90ab75a81f Author:Adam Harvey ahar...@php.net Tue, 15 Jan 2013 15:26:25 +0800 Parents: be1700d467a6875415c292f95040965fb359493c a4191b0aad94fb7bebb8fd5c4233006849845c31 Branches: PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ba329707101208db330acd3b07b96f90ab75a81f Log: Merge branch 'PHP-5.4' into PHP-5.5 * PHP-5.4: Update fputcsv() to escape all characters equally. Changed paths: MM ext/standard/file.c Diff: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed bug #57702 (Multi-row BLOB fetches): NEWS ext/pdo_oci/oci_statement.c ext/pdo_oci/tests/bug57702.phpt
Commit:4fcf4e084508ae18dddc02891f7c6fb10e49447e Author:Xinchen Hui larue...@php.net Tue, 15 Jan 2013 15:31:49 +0800 Parents: 6a065876b9212404daaf8fee1708834da83dac56 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4fcf4e084508ae18dddc02891f7c6fb10e49447e Log: Fixed bug #57702 (Multi-row BLOB fetches) Bugs: https://bugs.php.net/57702 Changed paths: M NEWS M ext/pdo_oci/oci_statement.c A ext/pdo_oci/tests/bug57702.phpt Diff: diff --git a/NEWS b/NEWS index 58a50bb..79d5d9a 100644 --- a/NEWS +++ b/NEWS @@ -20,8 +20,9 @@ PHP NEWS - PDO_sqlite: . Fixed bug #63916 (PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite). (srgoogleguy, Lars) + . Fixed bug #57702 (Multi-row BLOB fetches). (hswong3i, Laruence) . Fixed bug #52958 (Segfault in PDO_OCI on cleanup after running a long -testsuite) (hswong3i, Lars) +testsuite). (hswong3i, Lars) ?? ??? 2012, PHP 5.4.11 diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c index 2a93a66..dcb9557 100644 --- a/ext/pdo_oci/oci_statement.c +++ b/ext/pdo_oci/oci_statement.c @@ -99,7 +99,7 @@ static int oci_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ switch (S-cols[i].dtype) { case SQLT_BLOB: case SQLT_CLOB: - /* do nothing */ + OCIDescriptorFree(S-cols[i].data, OCI_DTYPE_LOB); break; default: efree(S-cols[i].data); @@ -654,7 +654,6 @@ static int oci_blob_close(php_stream *stream, int close_handle TSRMLS_DC) if (close_handle) { OCILobClose(self-S-H-svc, self-S-err, self-lob); - OCIDescriptorFree(self-lob, OCI_DTYPE_LOB); efree(self); } diff --git a/ext/pdo_oci/tests/bug57702.phpt b/ext/pdo_oci/tests/bug57702.phpt new file mode 100644 index 000..9281f6d --- /dev/null +++ b/ext/pdo_oci/tests/bug57702.phpt @@ -0,0 +1,165 @@ +--TEST-- +PDO OCI Bug #57702 (Multi-row BLOB fetches) +--SKIPIF-- +?php +if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded'); +require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc'); +PDOTest::skip(); +? +--FILE-- +?php + +require('ext/pdo/tests/pdo_test.inc'); +$db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt'); + +// Note the PDO test setup sets PDO::ATTR_STRINGIFY_FETCHES to true +// (and sets PDO::ATTR_CASE to PDO::CASE_LOWER) + +$query = begin execute immediate 'drop table mytable'; exception when others then if sqlcode -942 then raise; end if; end;; +$stmt = $db-prepare($query); +$stmt-execute(); + +$query = create table bug57702 (id number, data1 blob, data2 blob); +$stmt = $db-prepare($query); +$stmt-execute(); + +function do_insert($db, $id, $data1, $data2) +{ + $db-beginTransaction(); + $stmt = $db-prepare(insert into bug57702 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2); + $stmt-bindParam(':id', $id); + $stmt-bindParam(':blob1', $blob1, PDO::PARAM_LOB); + $stmt-bindParam(':blob2', $blob2, PDO::PARAM_LOB); + $blob1 = null; + $blob2 = null; + $stmt-execute(); + + fwrite($blob1, $data1); + fclose($blob1); + fwrite($blob2, $data2); + fclose($blob2); + $db-commit(); +} + +do_insert($db, 1, row 1 col 1, row 1 col 2); +do_insert($db, 2, row 2 col 1, row 2 col 2); + + + +echo First Query\n; + +// Fetch it back +$stmt = $db-prepare('select data1, data2 from bug57702 order by id'); +$stmt-execute(); +$row = $stmt-fetch(PDO::FETCH_ASSOC); +var_dump($row['data1']); +var_dump($row['data2']); +$row = $stmt-fetch(PDO::FETCH_ASSOC); +var_dump($row['data1']); +var_dump($row['data2']); + + + +echo \nSecond Query\n; + +foreach($db-query(select data1 as d1, data2 as d2 from bug57702 order by id) as $row) { + var_dump($row['d1']); + var_dump($row['d2']); +} + + + +echo \nThird Query\n; + +$stmt = $db-prepare('select data1 as d3_1, data2 as d3_2 from bug57702 order by id'); + +$rs = $stmt-execute(); +$stmt-bindColumn('d3_1' , $clob1, PDO::PARAM_LOB); +$stmt-bindColumn('d3_2' , $clob2, PDO::PARAM_LOB); + +while ($stmt-fetch(PDO::FETCH_BOUND)) { +var_dump($clob1); +var_dump($clob2); +} +print done\n; + + + +echo \nFourth Query\n; + +$a = array(); +$i = 0; +foreach($db-query(select data1 as d4_1, data2 as d4_2 from bug57702 order by id) as $row) { + $a[$i][0] = $row['d4_1']; + $a[$i][1] = $row['d4_2']; +$i++; +} + +for ($i = 0; $i count($a); $i++) { +
[PHP-CVS] com php-src: Apply the fputcsv test fix to SplFileObject_fputcsv.phpt. Mea culpa.: ext/spl/tests/SplFileObject_fputcsv.phpt
Commit:0510701474e8d99b5b30139b5599e44f9b555a5a Author:Adam Harvey ahar...@php.net Tue, 15 Jan 2013 15:49:13 +0800 Parents: 3bc74903706ab08e916905a0bd634e77aa804def Branches: PHP-5.4 PHP-5.5 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0510701474e8d99b5b30139b5599e44f9b555a5a Log: Apply the fputcsv test fix to SplFileObject_fputcsv.phpt. Mea culpa. Changed paths: M ext/spl/tests/SplFileObject_fputcsv.phpt Diff: diff --git a/ext/spl/tests/SplFileObject_fputcsv.phpt b/ext/spl/tests/SplFileObject_fputcsv.phpt index 66fdbfd..601edab 100644 --- a/ext/spl/tests/SplFileObject_fputcsv.phpt +++ b/ext/spl/tests/SplFileObject_fputcsv.phpt @@ -42,7 +42,7 @@ echo '$list = ';var_export($res);echo ;\n; $fp = fopen($file, r); $res = array(); -while($l=fgetcsv($fp)) +while($l=fgetcsv($fp, 0, ',', '', '')) { $res[] = join(',',$l); } @@ -76,10 +76,10 @@ $list = array ( 13 = 'aaa,bbb ', 14 = 'aa,bb', 15 = 'aa,bbb', - 16 = 'aaa,\\bbb,ccc', - 17 = 'aaa\\a,bbb', - 18 = '\\,aaa', - 19 = '\\,aaa', + 16 = 'aaa,\\bbb,ccc', + 17 = 'aaa\\a,bbb', + 18 = '\\,aaa', + 19 = '\\,aaa', ); $list = array ( 0 = 'aaa,bbb', -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php