[PHP-CVS] com php-src: Always reset those parameters.: ext/date/lib/unixtime2tm.c
Commit:261c6b31ca748fd97a105314ec78a166b2639db9 Author:Derick Rethans git...@derickrethans.nl Fri, 12 Apr 2013 11:23:49 +0100 Parents: 44a9e6b4843de686eab2e2bfa66bdf17ed685d7e Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=261c6b31ca748fd97a105314ec78a166b2639db9 Log: Always reset those parameters. Changed paths: M ext/date/lib/unixtime2tm.c Diff: diff --git a/ext/date/lib/unixtime2tm.c b/ext/date/lib/unixtime2tm.c index c177fee..194b3b2 100644 --- a/ext/date/lib/unixtime2tm.c +++ b/ext/date/lib/unixtime2tm.c @@ -137,19 +137,16 @@ void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts) void timelib_update_from_sse(timelib_time *tm) { timelib_sll sse; + int z = tm-z; + signed int dst = tm-dst; sse = tm-sse; switch (tm-zone_type) { case TIMELIB_ZONETYPE_ABBR: case TIMELIB_ZONETYPE_OFFSET: { - int z = tm-z; - signed int dst = tm-dst; - timelib_unixtime2gmt(tm, tm-sse - (tm-z * 60) + (tm-dst * 3600)); - tm-z = z; - tm-dst = dst; goto cleanup; } @@ -171,6 +168,8 @@ cleanup: tm-sse = sse; tm-is_localtime = 1; tm-have_zone = 1; + tm-z = z; + tm-dst = dst; } void timelib_unixtime2local(timelib_time *tm, timelib_sll ts) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Some rare deprecated cases replaced by ZEND_ASSERT() (some extensions might need to be fixed): Zend/zend_hash.c
Commit:b63b81815fa29e53cd1bd9e710efe568afbafdfb Author:Dmitry Stogov dmi...@zend.com Thu, 28 Nov 2013 17:02:01 +0400 Parents: aa427a10d4064e0873b3de8cf1b38f2dabc02913 Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b63b81815fa29e53cd1bd9e710efe568afbafdfb Log: Some rare deprecated cases replaced by ZEND_ASSERT() (some extensions might need to be fixed) Changed paths: M Zend/zend_hash.c Diff: diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 5d81c28..00ee6b8 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -199,12 +199,7 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKe IS_CONSISTENT(ht); - if (nKeyLength = 0) { -#if ZEND_DEBUG - ZEND_PUTS(zend_hash_update: Can't put in empty key\n); -#endif - return FAILURE; - } + ZEND_ASSERT(nKeyLength != 0); CHECK_INIT(ht); @@ -218,14 +213,8 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKe if (flag HASH_ADD) { return FAILURE; } + ZEND_ASSERT(p-pData != pData); HANDLE_BLOCK_INTERRUPTIONS(); -#if ZEND_DEBUG - if (p-pData == pData) { - ZEND_PUTS(Fatal error in zend_hash_update: p-pData == pData\n); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return FAILURE; - } -#endif if (ht-pDestructor) { ht-pDestructor(p-pData); } @@ -275,9 +264,7 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, ui IS_CONSISTENT(ht); - if (nKeyLength == 0) { - return zend_hash_index_update(ht, h, pData, nDataSize, pDest); - } + ZEND_ASSERT(nKeyLength != 0); CHECK_INIT(ht); nIndex = h ht-nTableMask; @@ -289,14 +276,8 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, ui if (flag HASH_ADD) { return FAILURE; } + ZEND_ASSERT(p-pData != pData); HANDLE_BLOCK_INTERRUPTIONS(); -#if ZEND_DEBUG - if (p-pData == pData) { - ZEND_PUTS(Fatal error in zend_hash_update: p-pData == pData\n); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return FAILURE; - } -#endif if (ht-pDestructor) { ht-pDestructor(p-pData); } @@ -370,14 +351,8 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void if (flag HASH_NEXT_INSERT || flag HASH_ADD) { return FAILURE; } + ZEND_ASSERT(p-pData != pData); HANDLE_BLOCK_INTERRUPTIONS(); -#if ZEND_DEBUG - if (p-pData == pData) { - ZEND_PUTS(Fatal error in zend_hash_index_update: p-pData == pData\n); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return FAILURE; - } -#endif if (ht-pDestructor) { ht-pDestructor(p-pData); } @@ -909,9 +884,7 @@ ZEND_API int zend_hash_quick_find(const HashTable *ht, const char *arKey, uint n uint nIndex; Bucket *p; - if (nKeyLength==0) { - return zend_hash_index_find(ht, h, pData); - } + ZEND_ASSERT(nKeyLength != 0); IS_CONSISTENT(ht); @@ -958,9 +931,7 @@ ZEND_API int zend_hash_quick_exists(const HashTable *ht, const char *arKey, uint uint nIndex; Bucket *p; - if (nKeyLength==0) { - return zend_hash_index_exists(ht, h); - } + ZEND_ASSERT(nKeyLength != 0); IS_CONSISTENT(ht); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: fixed ext/enchant: ext/enchant/enchant.c
Commit:4e2ddbc397f74c33c6f3514aede4e8d76bc54f53 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 13:59:55 +0100 Parents: 1e2cc1584594fd75ba742a7dd1b82a333e713890 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4e2ddbc397f74c33c6f3514aede4e8d76bc54f53 Log: fixed ext/enchant Changed paths: M ext/enchant/enchant.c Diff: diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index 98b5c9f..1f92d58 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -40,14 +40,14 @@ typedef struct _broker_struct { EnchantBroker *pbroker; enchant_dict**dict; unsigned intdictcnt; - longrsrc_id; + php_int_t rsrc_id; } _enchant_broker; typedef struct _dict_struct { unsigned intid; EnchantDict *pdict; enchant_broker *pbroker; - longrsrc_id; + php_int_t rsrc_id; enchant_dict*next; enchant_dict*prev; } _enchant_dict; @@ -421,11 +421,11 @@ PHP_FUNCTION(enchant_broker_set_dict_path) { zval *broker; enchant_broker *pbroker; - long dict_type; + php_int_t dict_type; char *value; - int value_len; + zend_str_size_int value_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rls, broker, dict_type, value, value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, riS, broker, dict_type, value, value_len) == FAILURE) { RETURN_FALSE; } @@ -461,10 +461,10 @@ PHP_FUNCTION(enchant_broker_get_dict_path) { zval *broker; enchant_broker *pbroker; - long dict_type; + php_int_t dict_type; char *value; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rl, broker, dict_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ri, broker, dict_type) == FAILURE) { RETURN_FALSE; } @@ -534,10 +534,10 @@ PHP_FUNCTION(enchant_broker_request_dict) enchant_dict *dict; EnchantDict *d; char *tag; - int taglen; + zend_str_size_int taglen; int pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rs, broker, tag, taglen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rS, broker, tag, taglen) == FAILURE) { RETURN_FALSE; } @@ -588,10 +588,10 @@ PHP_FUNCTION(enchant_broker_request_pwl_dict) enchant_dict *dict; EnchantDict *d; char *pwl; - int pwllen; + zend_str_size_int pwllen; int pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rp, broker, pwl, pwllen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rP, broker, pwl, pwllen) == FAILURE) { RETURN_FALSE; } @@ -656,10 +656,10 @@ PHP_FUNCTION(enchant_broker_dict_exists) { zval *broker; char *tag; - int taglen; + zend_str_size_int taglen; enchant_broker * pbroker; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rs, broker, tag, taglen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rS, broker, tag, taglen) == FAILURE) { RETURN_FALSE; } @@ -680,12 +680,12 @@ PHP_FUNCTION(enchant_broker_set_ordering) { zval *broker; char *pordering; - int porderinglen; + zend_str_size_int porderinglen; char *ptag; - int ptaglen; + zend_str_size_int ptaglen; enchant_broker * pbroker; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rss, broker, ptag, ptaglen, pordering, porderinglen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rSS, broker, ptag, ptaglen, pordering, porderinglen) == FAILURE) { RETURN_FALSE; } @@ -721,10 +721,10 @@ PHP_FUNCTION(enchant_dict_quick_check) { zval *dict, *sugg = NULL; char *word; - int wordlen; + zend_str_size_int wordlen; enchant_dict *pdict; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rs|z/, dict, word, wordlen, sugg) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rS|z/, dict, word, wordlen, sugg) == FAILURE) { RETURN_FALSE; } @@ -767,10 +767,10 @@ PHP_FUNCTION(enchant_dict_check) { zval *dict; char *word; - int wordlen; + zend_str_size_int wordlen; enchant_dict *pdict; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rs, dict, word, wordlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rS, dict, word, wordlen) == FAILURE) { RETURN_FALSE; } @@ -786,13 +786,13 @@ PHP_FUNCTION(enchant_dict_suggest) { zval
[PHP-CVS] com php-src: basic fixes for ext/gd: ext/gd/gd.c ext/gd/gd_ctx.c
Commit:51d78c253318158371ce9d547d0637392b5428a5 Author:Anatol Belski a...@php.net Fri, 29 Nov 2013 08:53:32 +0100 Parents: 57db68e03d46da1b1a2244e001550739c8eec468 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=51d78c253318158371ce9d547d0637392b5428a5 Log: basic fixes for ext/gd Changed paths: M ext/gd/gd.c M ext/gd/gd_ctx.c diff --git a/ext/gd/gd.c b/ext/gd/gd.c index d8a90f5..800a94e 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1420,12 +1420,13 @@ PHP_GD_API int phpi_get_le_gd(void) PHP_FUNCTION(imageloadfont) { char *file; - int file_name, hdr_size = sizeof(gdFont) - sizeof(char *); + zend_str_size_int file_name; + int hdr_size = sizeof(gdFont) - sizeof(char *); int ind, body_size, n = 0, b, i, body_size_check; gdFontPtr font; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, file, file_name) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S, file, file_name) == FAILURE) { return; } @@ -1563,10 +1564,10 @@ PHP_FUNCTION(imagesetstyle) Create a new true color image */ PHP_FUNCTION(imagecreatetruecolor) { - long x_size, y_size; + php_int_t x_size, y_size; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ll, x_size, y_size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ii, x_size, y_size) == FAILURE) { return; } @@ -1608,10 +1609,10 @@ PHP_FUNCTION(imagetruecolortopalette) { zval *IM; zend_bool dither; - long ncolors; + php_int_t ncolors; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rbl, IM, dither, ncolors) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rbi, IM, dither, ncolors) == FAILURE) { return; } @@ -1694,10 +1695,10 @@ PHP_FUNCTION(imagecolormatch) PHP_FUNCTION(imagesetthickness) { zval *IM; - long thick; + php_int_t thick; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rl, IM, thick) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ri, IM, thick) == FAILURE) { return; } @@ -1714,10 +1715,10 @@ PHP_FUNCTION(imagesetthickness) PHP_FUNCTION(imagefilledellipse) { zval *IM; - long cx, cy, w, h, color; + php_int_t cx, cy, w, h, color; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rl, IM, cx, cy, w, h, color) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ri, IM, cx, cy, w, h, color) == FAILURE) { return; } @@ -1734,11 +1735,11 @@ PHP_FUNCTION(imagefilledellipse) PHP_FUNCTION(imagefilledarc) { zval *IM; - long cx, cy, w, h, ST, E, col, style; + php_int_t cx, cy, w, h, ST, E, col, style; gdImagePtr im; int e, st; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, IM, cx, cy, w, h, ST, E, col, style) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, IM, cx, cy, w, h, ST, E, col, style) == FAILURE) { return; } @@ -1803,10 +1804,10 @@ PHP_FUNCTION(imagesavealpha) PHP_FUNCTION(imagelayereffect) { zval *IM; - long effect; + php_int_t effect; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rl, IM, effect) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ri, IM, effect) == FAILURE) { return; } @@ -1822,11 +1823,11 @@ PHP_FUNCTION(imagelayereffect) PHP_FUNCTION(imagecolorallocatealpha) { zval *IM; - long red, green, blue, alpha; + php_int_t red, green, blue, alpha; gdImagePtr im; int ct = (-1); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, IM, red, green, blue, alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, IM, red, green, blue, alpha) == FAILURE) { RETURN_FALSE; } @@ -1835,7 +1836,7 @@ PHP_FUNCTION(imagecolorallocatealpha) if (ct 0) { RETURN_FALSE; } - RETURN_LONG((long)ct); + RETURN_LONG((php_int_t)ct); } /* }}} */ @@ -1844,10 +1845,10 @@ PHP_FUNCTION(imagecolorallocatealpha) PHP_FUNCTION(imagecolorresolvealpha) { zval *IM; - long red, green, blue, alpha; + php_int_t red, green, blue, alpha; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, IM, red, green, blue, alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r, IM, red, green, blue, alpha) == FAILURE) { return; } @@ -1862,10
[PHP-CVS] com php-src: Updated NEWS for Constant Scalar Exprs RFC: NEWS
Commit:0652edfed3ac1a17f7677c78c663982b49a5f07b Author:Bob Weinand bobw...@hotmail.com Thu, 28 Nov 2013 13:46:51 +0100 Parents: d36cf9029110268e8ae7f700f620823dcaab5d8e Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0652edfed3ac1a17f7677c78c663982b49a5f07b Log: Updated NEWS for Constant Scalar Exprs RFC Changed paths: M NEWS Diff: diff --git a/NEWS b/NEWS index b17b3b0..29dd740 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,8 @@ PHP NEWS (RFC: https://wiki.php.net/rfc/variadics). (Nikita) . Fixed bug #50333 Improving multi-threaded scalability by using emalloc/efree/estrdup (Anatol, Dmitry) + . Implemented constant scalar expressions (with support for constants) +(RFC: https://wiki.php.net/rfc/const_scalar_exprs). (Bob) - cURL: . Implemented FR #65646 (re-enable CURLOPT_FOLLOWLOCATION with open_basedir -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Use class handlers for GMP serialization: ext/gmp/gmp.c
Commit:1c8cbe4b4e8e373b37c740b7d96e4beb96414ea0 Author:Nikita Popov ni...@php.net Sun, 24 Nov 2013 00:43:12 +0100 Parents: 8860758a74ce5b2237e3b00131cbb63abd4613bb Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1c8cbe4b4e8e373b37c740b7d96e4beb96414ea0 Log: Use class handlers for GMP serialization A bit faster and less boilerplate Changed paths: M ext/gmp/gmp.c Diff: diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 9a49bec..d3b6189 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -27,7 +27,6 @@ #include ext/standard/php_var.h #include ext/standard/php_smart_str_public.h #include zend_exceptions.h -#include zend_interfaces.h #if HAVE_GMP @@ -686,57 +685,51 @@ static int gmp_compare(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ } /* }}} */ -PHP_METHOD(GMP, serialize) /* {{{ */ +static int gmp_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC) /* {{{ */ { - mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(getThis()); + mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(object); smart_str buf = {0}; - php_serialize_data_t var_hash; zval zv, *zv_ptr = zv; + php_serialize_data_t *serialize_data = (php_serialize_data_t *) data; - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - PHP_VAR_SERIALIZE_INIT(var_hash); + PHP_VAR_SERIALIZE_INIT(*serialize_data); INIT_PZVAL(zv_ptr); gmp_strval(zv_ptr, gmpnum, 10); - php_var_serialize(buf, zv_ptr, var_hash TSRMLS_CC); + php_var_serialize(buf, zv_ptr, serialize_data TSRMLS_CC); zval_dtor(zv_ptr); - Z_ARRVAL_P(zv_ptr) = zend_std_get_properties(getThis() TSRMLS_CC); + Z_ARRVAL_P(zv_ptr) = zend_std_get_properties(object TSRMLS_CC); Z_TYPE_P(zv_ptr) = IS_ARRAY; - php_var_serialize(buf, zv_ptr, var_hash TSRMLS_CC); + php_var_serialize(buf, zv_ptr, serialize_data TSRMLS_CC); - PHP_VAR_SERIALIZE_DESTROY(var_hash); + PHP_VAR_SERIALIZE_DESTROY(*serialize_data); - if (buf.c) { - RETURN_STRINGL(buf.c, buf.len, 0); - } + *buffer = (unsigned char *) buf.c; + *buf_len = buf.len; + + return SUCCESS; } /* }}} */ -PHP_METHOD(GMP, unserialize) /* {{{ */ +static int gmp_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) /* {{{ */ { - mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(getThis()); - char *str; - int str_len; - php_unserialize_data_t var_hash; + mpz_ptr gmpnum; const unsigned char *p, *max; zval zv, *zv_ptr = zv; + int retval = FAILURE; + php_unserialize_data_t *unserialize_data = (php_unserialize_data_t *) data; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, str, str_len) == FAILURE) { - return; - } + PHP_VAR_UNSERIALIZE_INIT(*unserialize_data); - PHP_VAR_UNSERIALIZE_INIT(var_hash); + gmp_create_ex(*object, gmpnum TSRMLS_CC); - p = (unsigned char *) str; - max = (unsigned char *) str + str_len; + p = buf; + max = buf + buf_len; INIT_ZVAL(zv); - if (!php_var_unserialize(zv_ptr, p, max, var_hash TSRMLS_CC) + if (!php_var_unserialize(zv_ptr, p, max, unserialize_data TSRMLS_CC) || Z_TYPE_P(zv_ptr) != IS_STRING || convert_to_gmp(gmpnum, zv_ptr, 10 TSRMLS_CC) == FAILURE ) { @@ -746,7 +739,7 @@ PHP_METHOD(GMP, unserialize) /* {{{ */ zval_dtor(zv); INIT_ZVAL(zv); - if (!php_var_unserialize(zv_ptr, p, max, var_hash TSRMLS_CC) + if (!php_var_unserialize(zv_ptr, p, max, unserialize_data TSRMLS_CC) || Z_TYPE_P(zv_ptr) != IS_ARRAY ) { zend_throw_exception(NULL, Could not unserialize properties, 0 TSRMLS_CC); @@ -755,30 +748,19 @@ PHP_METHOD(GMP, unserialize) /* {{{ */ if (zend_hash_num_elements(Z_ARRVAL_P(zv_ptr)) != 0) { zend_hash_copy( - zend_std_get_properties(getThis() TSRMLS_CC), Z_ARRVAL_P(zv_ptr), + zend_std_get_properties(*object TSRMLS_CC), Z_ARRVAL_P(zv_ptr), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *) ); } + retval = SUCCESS; exit: zval_dtor(zv); - PHP_VAR_UNSERIALIZE_DESTROY(var_hash); + PHP_VAR_UNSERIALIZE_DESTROY(*unserialize_data); + return retval; } /* }}} */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_serialize, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_unserialize, 0, 0, 1) -ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -const zend_function_entry gmp_methods[] = { - PHP_ME(GMP, serialize, arginfo_serialize, ZEND_ACC_PUBLIC) - PHP_ME(GMP, unserialize, arginfo_unserialize, ZEND_ACC_PUBLIC) -
[PHP-CVS] com php-src: Merge branch 'const_scalar_exprs' of github.com:bwoebi/php-src into const_scalar_exprs: Zend/Makefile.am Zend/Zend.dsp Zend/zend.h Zend/zend_compile.c Zend/zend_vm_execute.h con
Commit:af600c240d2efe33291e8dd71ce228b9fbc849c1 Author:Dmitry Stogov dmi...@zend.com Wed, 6 Nov 2013 15:41:33 +0400 Parents: d87388ba0f6cf29eb495f9af96ab6aa353ebcc4f 18e2b1a9a930d5ae15544c5a2beed6b20d58cdee Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=af600c240d2efe33291e8dd71ce228b9fbc849c1 Log: Merge branch 'const_scalar_exprs' of github.com:bwoebi/php-src into const_scalar_exprs * 'const_scalar_exprs' of github.com:bwoebi/php-src: Removed operations on constant arrays. They make no sense as constants are not allowed to be arrays. And as just properties are allowed to; no problem, we still don't need operations on any constant array. Added a few more operators Whitespace fix converted several switches to ifs and made more opcache friendly Fatal error about self referencing constants fixed Fixed mem leaks, added tests and ternary operator Working commit for constant scalar expressions (with constants). Tests will follow. Conflicts: Zend/Makefile.am configure.in win32/build/config.w32 Changed paths: MM Zend/Makefile.am MM Zend/Zend.dsp MM Zend/zend.h MM Zend/zend_compile.c MM Zend/zend_vm_execute.h MM configure.in MM win32/build/config.w32 Diff: diff --cc Zend/Makefile.am index 924a00d,d031608..d9ce4c6 --- a/Zend/Makefile.am +++ b/Zend/Makefile.am @@@ -18,7 -18,8 +18,7 @@@ libZend_la_SOURCES= zend_default_classes.c \ zend_iterators.c zend_interfaces.c zend_exceptions.c \ zend_strtod.c zend_closures.c zend_float.c zend_string.c zend_signal.c \ - zend_generators.c zend_virtual_cwd.c - zend_generators.c \ - zend_ast.c ++ zend_generators.c zend_virtual_cwd.c zend_ast.c libZend_la_LDFLAGS = libZend_la_LIBADD = @ZEND_EXTRA_LIBS@ diff --cc configure.in index 805aa48,97fd68e..29358b1 --- a/configure.in +++ b/configure.in @@@ -1475,8 -1475,9 +1475,8 @@@ PHP_ADD_SOURCES(Zend, zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \ zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \ zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \ -zend_closures.c zend_float.c zend_string.c zend_signal.c \ -zend_generators.c \ -zend_ast.c) +zend_closures.c zend_float.c zend_string.c zend_signal.c zend_generators.c \ - zend_virtual_cwd.c) ++zend_virtual_cwd.c zend_ast.c) if test -r $abs_srcdir/Zend/zend_objects.c; then PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_default_classes.c) diff --cc win32/build/config.w32 index af92eb0,d9bbc7e..6e19c48 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@@ -364,7 -364,9 +364,7 @@@ ADD_SOURCES(Zend, zend_language_pars zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \ zend_object_handlers.c zend_objects_API.c \ zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c \ - zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c); - zend_float.c zend_string.c \ - zend_generators.c \ - zend_ast.c); ++ zend_float.c zend_string.c zend_generators.c zend_virtual_cwd.c zend_ast.c); if (VCVERS == 1200) { AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: reverted a couple of things in ext/phar for now, but all tests pass now: ext/phar/phar_internal.h ext/phar/phar_object.c ext/phar/stream.c
Commit:de453dbef6cc7a0ead22d82871331eb8c15a2b08 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 09:23:02 +0100 Parents: d135198559cd14805b42a2ddbe48511674475c40 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=de453dbef6cc7a0ead22d82871331eb8c15a2b08 Log: reverted a couple of things in ext/phar for now, but all tests pass now Changed paths: M ext/phar/phar_internal.h M ext/phar/phar_object.c M ext/phar/stream.c Diff: diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index 1a8bd1d..2f9320a 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -179,15 +179,15 @@ ZEND_BEGIN_MODULE_GLOBALS(phar) void(*orig_stat)(INTERNAL_FUNCTION_PARAMETERS); /* used for includes with . in them inside front controller */ char* cwd; - zend_str_size_int cwd_len; + php_int_t cwd_len; int cwd_init; char*openssl_privatekey; int openssl_privatekey_len; /* phar_get_archive cache */ char* last_phar_name; - zend_str_size_int last_phar_name_len; + int last_phar_name_len; char* last_alias; - zend_str_size_int last_alias_len; + int last_alias_len; phar_archive_data* last_phar; HashTable mime_types; ZEND_END_MODULE_GLOBALS(phar) @@ -244,7 +244,7 @@ typedef struct _phar_entry_info { /* when changing compression, save old flags in case fp is NULL */ php_uint32 old_flags; zval *metadata; - zend_str_size_int metadata_len; /* only used for cached manifests */ + int metadata_len; /* only used for cached manifests */ php_uint32 filename_len; char *filename; enum phar_fp_typefp_type; @@ -287,12 +287,12 @@ typedef struct _phar_entry_info { /* information about a phar file (the archive itself) */ struct _phar_archive_data { char *fname; - int fname_len; + zend_str_size_int fname_len; /* for phar_detect_fname_ext, this stores the location of the file extension within fname */ char *ext; zend_str_size_int ext_len; char *alias; - zend_str_size_int alias_len; + int alias_len; char version[12]; size_t internal_file_start; size_t halt_offset; @@ -312,7 +312,7 @@ struct _phar_archive_data { zend_str_size_int sig_len; char *signature; zval *metadata; - zend_str_size_int metadata_len; /* only used for cached manifests */ + int metadata_len; /* only used for cached manifests */ uint phar_pos; /* if 1, then this alias was manually specified by the user and is not a permanent alias */ unsigned int is_temporary_alias:1; @@ -456,7 +456,7 @@ static inline zend_off_t phar_get_fp_offset(phar_entry_info *entry TSRMLS_DC) typedef struct _phar_mime_type { char *mime; - zend_str_size_int len; + int len; /* one of PHAR_MIME_* */ char type; } phar_mime_type; diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index aac24a6..54b641b 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1978,7 +1978,7 @@ PHP_METHOD(Phar, isFileFormat) static int phar_copy_file_contents(phar_entry_info *entry, php_stream *fp TSRMLS_DC) /* {{{ */ { char *error; - off_t offset; + zend_off_t offset; phar_entry_info *link; if (FAILURE == phar_open_entry_fp(entry, error, 1 TSRMLS_CC)) { diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 6a2bb6c..4ba0e1f 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -413,7 +413,7 @@ static int phar_stream_seek(php_stream *stream, zend_off_t offset, int whence, z default: temp = 0; } - if (temp data-zero + (off_t) entry-uncompressed_filesize) { + if (temp data-zero + (zend_off_t) entry-uncompressed_filesize) { *newoffset = -1; return -1; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fatal error about self referencing constants fixed: Zend/zend_execute_API.c
Commit:b56c1ca95e16ea1c2a3ce251b91297d0a81a9070 Author:Bob Weinand bobw...@hotmail.com Thu, 31 Oct 2013 19:05:29 +0100 Parents: 466c5dd1fe194ab3d1634695e2dc96240f951f50 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b56c1ca95e16ea1c2a3ce251b91297d0a81a9070 Log: Fatal error about self referencing constants fixed Changed paths: M Zend/zend_execute_API.c Diff: diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index a66cdee..e5b68c7 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -675,8 +675,6 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco case IS_CONSTANT_AST: { zend_ast *ast = Z_AST_P(p); - MARK_CONSTANT_VISITED(p); - zend_ast_evaluate(p, ast TSRMLS_CC); ZEND_AST_DEL_REF(ast); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: further fixes for ext/gd: ext/gd/gd.c
Commit:3659dcd98c5a4dcfcad2129e59e0794f4dcac1ca Author:Anatol Belski a...@php.net Fri, 29 Nov 2013 09:18:13 +0100 Parents: 51d78c253318158371ce9d547d0637392b5428a5 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3659dcd98c5a4dcfcad2129e59e0794f4dcac1ca Log: further fixes for ext/gd Changed paths: M ext/gd/gd.c Diff: diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 800a94e..fa944c6 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1422,7 +1422,8 @@ PHP_FUNCTION(imageloadfont) char *file; zend_str_size_int file_name; int hdr_size = sizeof(gdFont) - sizeof(char *); - int ind, body_size, n = 0, b, i, body_size_check; + int ind, body_size, n = 0, b; + zend_off_t body_size_check, i; gdFontPtr font; php_stream *stream; @@ -3396,7 +3397,7 @@ PHP_FUNCTION(imagefilledpolygon) /* {{{ php_find_gd_font */ -static gdFontPtr php_find_gd_font(int size TSRMLS_DC) +static gdFontPtr php_find_gd_font(php_int_t size TSRMLS_DC) { gdFontPtr font; int ind_type; @@ -3830,7 +3831,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int do { zval ** item; char * key; - ulong num_key; + php_uint_t num_key; if (zend_hash_get_current_key_ex(HASH_OF(EXT), key, NULL, num_key, 0, pos) != HASH_KEY_IS_STRING) { continue; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Merge branch 'master' into str_size_and_int64: Zend/zend_API.c Zend/zend_compile.c Zend/zend_compile.h Zend/zend_execute.c Zend/zend_vm_def.h Zend/zend_vm_execute.h ext/date/php
Commit:3f7522a652d2c90ca594cdb02b4083ce64213e46 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 09:29:12 +0100 Parents: de453dbef6cc7a0ead22d82871331eb8c15a2b08 98f3c410d9c93e64c4e109b8f55e6d2f5cdabaac Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3f7522a652d2c90ca594cdb02b4083ce64213e46 Log: Merge branch 'master' into str_size_and_int64 Changed paths: MM Zend/zend_API.c MM Zend/zend_compile.c MM Zend/zend_compile.h MM Zend/zend_execute.c MM Zend/zend_vm_def.h MM Zend/zend_vm_execute.h MM ext/date/php_date.c Diff: diff --cc Zend/zend_execute.c index 85b8cd8,5aea39e..aab1dc9 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@@ -1313,9 -1310,9 +1310,9 @@@ static void zend_fetch_dimension_addres Z_STRVAL_P(ptr) = (char*)emalloc(2); Z_STRVAL_P(ptr)[0] = Z_STRVAL_P(container)[Z_LVAL_P(dim)]; Z_STRVAL_P(ptr)[1] = 0; - Z_STRLEN_P(ptr) = 1; + Z_STRSIZE_P(ptr) = 1; } - AI_SET_PTR(result, ptr); + result-var.ptr = ptr; return; } break; diff --cc Zend/zend_vm_def.h index 4640e42,6eca6d0..3821374 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@@ -1962,10 -1951,10 +1951,10 @@@ ZEND_VM_HELPER(zend_do_fcall_common_hel LOAD_OPLINE(); if (fbc-type == ZEND_INTERNAL_FUNCTION) { - if (fbc-common.arg_info) { + if (fbc-common.fn_flags ZEND_ACC_HAS_TYPE_HINTS) { zend_uint i=0; zval **p = (zval**)EX(function_state).arguments; - ulong arg_count = opline-extended_value; + zend_uint_t arg_count = opline-extended_value; while (arg_count0) { zend_verify_arg_type(fbc, ++i, *(p-arg_count), 0 TSRMLS_CC); diff --cc Zend/zend_vm_execute.h index 0a7912b,dcb1183..0e38bb7 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@@ -530,10 -530,10 +530,10 @@@ static int ZEND_FASTCALL zend_do_fcall_ LOAD_OPLINE(); if (fbc-type == ZEND_INTERNAL_FUNCTION) { - if (fbc-common.arg_info) { + if (fbc-common.fn_flags ZEND_ACC_HAS_TYPE_HINTS) { zend_uint i=0; zval **p = (zval**)EX(function_state).arguments; - ulong arg_count = opline-extended_value; + zend_uint_t arg_count = opline-extended_value; while (arg_count0) { zend_verify_arg_type(fbc, ++i, *(p-arg_count), 0 TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: fixed ext/xml: ext/xml/expat_compat.h ext/xml/php_xml.h ext/xml/xml.c
Commit:262fca3a39137a22c5fb237e453e68ef64dce126 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 19:46:08 +0100 Parents: d9a036cc3065aeb45cd818ce810e316780a458b7 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=262fca3a39137a22c5fb237e453e68ef64dce126 Log: fixed ext/xml Changed paths: M ext/xml/expat_compat.h M ext/xml/php_xml.h M ext/xml/xml.c diff --git a/ext/xml/expat_compat.h b/ext/xml/expat_compat.h index 1c94e45..1312e51 100644 --- a/ext/xml/expat_compat.h +++ b/ext/xml/expat_compat.h @@ -5,7 +5,7 @@ | Copyright (c) 1997-2013 The PHP Group| +--+ | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is| +bundled with this package in the file LICENSE, and is| | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | diff --git a/ext/xml/php_xml.h b/ext/xml/php_xml.h index 7766834..42de397 100644 --- a/ext/xml/php_xml.h +++ b/ext/xml/php_xml.h @@ -134,8 +134,8 @@ PHP_FUNCTION(utf8_decode); PHP_FUNCTION(xml_parse_into_struct); PHPAPI char *_xml_zval_strdup(zval *val); -PHPAPI char *xml_utf8_decode(const XML_Char *, int, int *, const XML_Char *); -PHPAPI char *xml_utf8_encode(const char *s, int len, int *newlen, const XML_Char *encoding); +PHPAPI char *xml_utf8_decode(const XML_Char *, zend_str_size_int, zend_str_size_int *, const XML_Char *); +PHPAPI char *xml_utf8_encode(const char *s, zend_str_size_int len, zend_str_size_int *newlen, const XML_Char *encoding); #endif /* HAVE_LIBEXPAT */ diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 1ef01c8..f3571a9 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -78,7 +78,7 @@ inline static char xml_decode_iso_8859_1(unsigned short); inline static unsigned short xml_encode_us_ascii(unsigned char); inline static char xml_decode_us_ascii(unsigned short); static zval *xml_call_handler(xml_parser *, zval *, zend_function *, int, zval **); -static zval *_xml_xmlchar_zval(const XML_Char *, int, const XML_Char *); +static zval *_xml_xmlchar_zval(const XML_Char *, zend_str_size_int, const XML_Char *); static int _xml_xmlcharlen(const XML_Char *); static void _xml_add_to_info(xml_parser *parser,char *name); inline static char *_xml_decode_tag(xml_parser *parser, const char *tag); @@ -373,7 +373,7 @@ PHP_MINFO_FUNCTION(xml) /* }}} */ /* {{{ extension-internal functions */ -static zval *_xml_resource_zval(long value) +static zval *_xml_resource_zval(php_int_t value) { zval *ret; TSRMLS_FETCH(); @@ -395,12 +395,12 @@ static zval *_xml_string_zval(const char *str) MAKE_STD_ZVAL(ret); Z_TYPE_P(ret) = IS_STRING; - Z_STRLEN_P(ret) = len; + Z_STRSIZE_P(ret) = len; Z_STRVAL_P(ret) = estrndup(str, len); return ret; } -static zval *_xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encoding) +static zval *_xml_xmlchar_zval(const XML_Char *s, zend_str_size_int len, const XML_Char *encoding) { zval *ret; MAKE_STD_ZVAL(ret); @@ -413,7 +413,7 @@ static zval *_xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encod len = _xml_xmlcharlen(s); } Z_TYPE_P(ret) = IS_STRING; - Z_STRVAL_P(ret) = xml_utf8_decode(s, len, Z_STRLEN_P(ret), encoding); + Z_STRVAL_P(ret) = xml_utf8_decode(s, len, Z_STRSIZE_P(ret), encoding); return ret; } /* }}} */ @@ -488,7 +488,7 @@ static void xml_set_handler(zval **handler, zval **data) if (Z_TYPE_PP(data) != IS_ARRAY Z_TYPE_PP(data) != IS_OBJECT) { convert_to_string_ex(data); - if (Z_STRLEN_PP(data) == 0) { + if (Z_STRSIZE_PP(data) == 0) { *handler = NULL; return; } @@ -607,9 +607,9 @@ static xml_encoding *xml_get_encoding(const XML_Char *name) /* }}} */ /* {{{ xml_utf8_encode */ -PHPAPI char *xml_utf8_encode(const char *s, int len, int *newlen, const XML_Char *encoding) +PHPAPI char *xml_utf8_encode(const char *s, zend_str_size_int len, zend_str_size_int *newlen, const XML_Char *encoding) { - int pos = len; + zend_str_size_int pos = len; char *newbuf; unsigned int c; unsigned short (*encoder)(unsigned char) = NULL; @@ -661,7 +661,7 @@ PHPAPI char *xml_utf8_encode(const char *s, int len, int *newlen, const XML_Char /* }}} */ /* {{{ xml_utf8_decode */ -PHPAPI char *xml_utf8_decode(const XML_Char *s, int len, int *newlen, const XML_Char *encoding) +PHPAPI char *xml_utf8_decode(const XML_Char *s, zend_str_size_int len, zend_str_size_int *newlen, const XML_Char
[PHP-CVS] com php-src: Avoid interned hash key duplication and hash key length recaclulation: Zend/zend_builtin_functions.c Zend/zend_hash.c ext/pcre/php_pcre.c ext/soap/php_http.c
Commit:6c2a8068207a02b3d7ae7416a9967dad0a81e61f Author:Dmitry Stogov dmi...@zend.com Fri, 29 Nov 2013 00:57:49 +0400 Parents: 5d2576264653c2faaca9cd7d64218d10ab612408 Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6c2a8068207a02b3d7ae7416a9967dad0a81e61f Log: Avoid interned hash key duplication and hash key length recaclulation Changed paths: M Zend/zend_builtin_functions.c M Zend/zend_hash.c M ext/pcre/php_pcre.c M ext/soap/php_http.c Diff: diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index d779e8a..91bca37 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -609,9 +609,9 @@ ZEND_FUNCTION(each) Z_ADDREF_P(entry); /* add the key elements */ - switch (zend_hash_get_current_key_ex(target_hash, string_key, string_key_len, num_key, 1, NULL)) { + switch (zend_hash_get_current_key_ex(target_hash, string_key, string_key_len, num_key, 0, NULL)) { case HASH_KEY_IS_STRING: - add_get_index_stringl(return_value, 0, string_key, string_key_len-1, (void **) inserted_pointer, 0); + add_get_index_stringl(return_value, 0, string_key, string_key_len-1, (void **) inserted_pointer, !IS_INTERNED(string_key)); break; case HASH_KEY_IS_LONG: add_get_index_long(return_value, 0, num_key, (void **) inserted_pointer); @@ -950,7 +950,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value zval_update_constant(prop_copy, 0 TSRMLS_CC); } - add_assoc_zval(return_value, key, prop_copy); + zend_hash_update(Z_ARRVAL_P(return_value), key, key_len, prop_copy, sizeof(zval*), NULL); } } /* }}} */ @@ -1020,7 +1020,14 @@ ZEND_FUNCTION(get_object_vars) zend_unmangle_property_name_ex(key, key_len - 1, class_name, prop_name, (int*) prop_len); /* Not separating references */ Z_ADDREF_PP(value); - add_assoc_zval_ex(return_value, prop_name, prop_len + 1, *value); + if (IS_INTERNED(key) prop_name != key) { + /* we can't use substring of interned string as a new key */ + char *tmp = estrndup(prop_name, prop_len); + add_assoc_zval_ex(return_value, tmp, prop_len + 1, *value); + efree(tmp); + } else { + add_assoc_zval_ex(return_value, prop_name, prop_len + 1, *value); + } } } zend_hash_move_forward_ex(properties, pos); @@ -1476,6 +1483,7 @@ ZEND_FUNCTION(crash) ZEND_FUNCTION(get_included_files) { char *entry; + uint entry_len; if (zend_parse_parameters_none() == FAILURE) { return; @@ -1483,8 +1491,8 @@ ZEND_FUNCTION(get_included_files) array_init(return_value); zend_hash_internal_pointer_reset(EG(included_files)); - while (zend_hash_get_current_key(EG(included_files), entry, NULL, 1) == HASH_KEY_IS_STRING) { - add_next_index_string(return_value, entry, 0); + while (zend_hash_get_current_key_ex(EG(included_files), entry, entry_len, NULL, 0, NULL) == HASH_KEY_IS_STRING) { + add_next_index_stringl(return_value, entry, entry_len-1, !IS_INTERNED(entry)); zend_hash_move_forward(EG(included_files)); } } diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index b8aa679..e938d1d 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -1123,7 +1123,7 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, Z_TYPE_P(key) = IS_NULL; } else if (p-nKeyLength) { Z_TYPE_P(key) = IS_STRING; - Z_STRVAL_P(key) = estrndup(p-arKey, p-nKeyLength - 1); + Z_STRVAL_P(key) = IS_INTERNED(p-arKey) ? (char*)p-arKey : estrndup(p-arKey, p-nKeyLength - 1); Z_STRLEN_P(key) = p-nKeyLength - 1; } else { Z_TYPE_P(key) = IS_LONG; diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 7d34d9f..1e88291 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1343,6 +1343,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl int limit_val = -1; longlimit = -1; char*string_key; + uint string_key_len; ulongnum_key; char*callback_name; int
[PHP-CVS] com php-src: Split up tests into their different categories.: ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd
Commit:aa26ace21f1457bfcc5faf417d9d453b82944aba Author:Derick Rethans git...@derickrethans.nl Sat, 13 Apr 2013 23:28:59 +0100 Parents: 7a0df7be34d35e91406b9654cb7be1de9b8720c1 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=aa26ace21f1457bfcc5faf417d9d453b82944aba Log: Split up tests into their different categories. Changed paths: A ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt A ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt A ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt A ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt A ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt A ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt A ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt D ext/date/tests/rfc-datetime_and_daylight_saving_time-type3.phpt diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt new file mode 100644 index 000..45db229 --- /dev/null +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt @@ -0,0 +1,96 @@ +--TEST-- +RFC: DateTime and Daylight Saving Time Transitions (zone type 3, ba) +--CREDITS-- +Daniel Convissor dani...@php.net +--FILE-- +?php + +date_default_timezone_set('America/New_York'); +$date_format = 'Y-m-d H:i:s T e'; +$interval_format = 'P%dDT%hH'; + +/* + * Backward Transitions, add(). + */ + +$start = new DateTime('2010-11-07 01:59:59'); +$interval_spec = 'PT1S'; +$interval = new DateInterval($interval_spec); +echo 'ba1 ' . $start-format($date_format) . + $interval_spec = + . $start-add($interval)-format($date_format) . \n; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba2 ' . $start-format($date_format) . + $interval_spec = + . $start-add($interval)-format($date_format) . \n; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'PT24H'; +$interval = new DateInterval($interval_spec); +echo 'ba3 ' . $start-format($date_format) . + $interval_spec = + . $start-add($interval)-format($date_format) . \n; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'PT23H'; +$interval = new DateInterval($interval_spec); +echo 'ba4 ' . $start-format($date_format) . + $interval_spec = + . $start-add($interval)-format($date_format) . \n; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'PT22H'; +$interval = new DateInterval($interval_spec); +echo 'ba5 ' . $start-format($date_format) . + $interval_spec = + . $start-add($interval)-format($date_format) . \n; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'PT21H'; +$interval = new DateInterval($interval_spec); +echo 'ba6 ' . $start-format($date_format) . + $interval_spec = + . $start-add($interval)-format($date_format) . \n; + +$start = new DateTime('2010-11-06 01:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba7 ' . $start-format($date_format) . + $interval_spec = + . $start-add($interval)-format($date_format) . \n; + +$start = new DateTime('2010-11-06 01:30:00'); +$interval_spec = 'P1DT1H'; +$interval = new DateInterval($interval_spec); +echo 'ba8 ' . $start-format($date_format) . + $interval_spec = + . $start-add($interval)-format($date_format) . \n; + +$start = new DateTime('2010-11-06 04:30:00'); +$interval_spec = 'PT25H'; +$interval = new DateInterval($interval_spec); +echo 'ba9 ' . $start-format($date_format) . + $interval_spec = + . $start-add($interval)-format($date_format) . \n; + +$start = new DateTime('2010-11-06 03:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba10 ' . $start-format($date_format) . + $interval_spec = + . $start-add($interval)-format($date_format) . \n; + +$start = new DateTime('2010-11-06 02:30:00'); +$interval_spec = 'P1D'; +$interval = new DateInterval($interval_spec); +echo 'ba11 ' . $start-format($date_format) . + $interval_spec = + . $start-add($interval)-format($date_format) . \n; + +echo \n; + +? +--EXPECT-- +ba1 2010-11-07 01:59:59 EDT America/New_York + PT1S = 2010-11-07 01:00:00 EST America/New_York +ba2 2010-11-06 04:30:00 EDT America/New_York + P1D = 2010-11-07 04:30:00 EST America/New_York +ba3 2010-11-06 04:30:00 EDT America/New_York + PT24H = 2010-11-07 03:30:00 EST America/New_York +ba4 2010-11-06 04:30:00 EDT America/New_York + PT23H = 2010-11-07 02:30:00 EST America/New_York +ba5 2010-11-06 04:30:00 EDT America/New_York + PT22H = 2010-11-07 01:30:00 EST America/New_York +ba6 2010-11-06 04:30:00 EDT America/New_York + PT21H = 2010-11-07 01:30:00 EDT America/New_York +ba7 2010-11-06 01:30:00 EDT America/New_York + P1D = 2010-11-07 01:30:00 EDT America/New_York
[PHP-CVS] com php-src: Moved arrays again to static_scalar: little cleanup: Zend/tests/static_variable.phpt Zend/zend_ast.c Zend/zend_ast.h Zend/zend_extensions.h Zend/zend_language_parser.y ext/o
Commit:152898ff2872f2bdf2123a52c37f6e64c18ab88a Author:Bob Weinand bobw...@hotmail.com Thu, 7 Nov 2013 16:39:47 +0100 Parents: e0135014c3b4edaf67312677c440a93133fe6a0c Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=152898ff2872f2bdf2123a52c37f6e64c18ab88a Log: Moved arrays again to static_scalar: little cleanup Changed paths: M Zend/tests/static_variable.phpt M Zend/zend_ast.c M Zend/zend_ast.h M Zend/zend_extensions.h M Zend/zend_language_parser.y M ext/opcache/zend_accelerator_util_funcs.c M ext/opcache/zend_persist.c M ext/opcache/zend_persist_calc.c diff --git a/Zend/tests/static_variable.phpt b/Zend/tests/static_variable.phpt index ea69a8f..62ca565 100644 --- a/Zend/tests/static_variable.phpt +++ b/Zend/tests/static_variable.phpt @@ -7,7 +7,7 @@ const bar = 2, baz = bar + 1; function foo() { static $a = 1 + 1; static $b = [bar = 1 + 1, baz * 2 = 1 2]; - static $c = [1 = bar] + [3 = baz]; + static $c = [1 = bar, 3 = baz]; var_dump($a, $b, $c); } diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 7495da3..fb5a7eb 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -25,42 +25,42 @@ ZEND_API zend_ast *zend_ast_create_constant(zval *zv) { - zend_ast *node = emalloc(sizeof(zend_ast) + sizeof(zval)); - node-kind = ZEND_CONST; - node-children = 0; - node-u.val = (zval*)(node + 1); - INIT_PZVAL_COPY(node-u.val, zv); - return node; + zend_ast *ast = emalloc(sizeof(zend_ast) + sizeof(zval)); + ast-kind = ZEND_CONST; + ast-children = 0; + ast-u.val = (zval*)(ast + 1); + INIT_PZVAL_COPY(ast-u.val, zv); + return ast; } ZEND_API zend_ast* zend_ast_create_unary(uint kind, zend_ast *op0) { - zend_ast *node = emalloc(sizeof(zend_ast)); - node-kind = kind; - node-children = 1; - node-u.child[0] = op0; - return node; + zend_ast *ast = emalloc(sizeof(zend_ast)); + ast-kind = kind; + ast-children = 1; + (ast-u.child)[0] = op0; + return ast; } ZEND_API zend_ast* zend_ast_create_binary(uint kind, zend_ast *op0, zend_ast *op1) { - zend_ast *node = emalloc(sizeof(zend_ast) + sizeof(zend_ast*)); - node-kind = kind; - node-children = 2; - node-u.child[0] = op0; - node-u.child[1] = op1; - return node; + zend_ast *ast = emalloc(sizeof(zend_ast) + sizeof(zend_ast*)); + ast-kind = kind; + ast-children = 2; + (ast-u.child)[0] = op0; + (ast-u.child)[1] = op1; + return ast; } ZEND_API zend_ast* zend_ast_create_ternary(uint kind, zend_ast *op0, zend_ast *op1, zend_ast *op2) { - zend_ast *node = emalloc(sizeof(zend_ast) + sizeof(zend_ast*) * 2); - node-kind = kind; - node-children = 3; - node-u.child[0] = op0; - node-u.child[1] = op1; - node-u.child[2] = op2; - return node; + zend_ast *ast = emalloc(sizeof(zend_ast) + sizeof(zend_ast*) * 2); + ast-kind = kind; + ast-children = 3; + (ast-u.child)[0] = op0; + (ast-u.child)[1] = op1; + (ast-u.child)[2] = op2; + return ast; } ZEND_API int zend_ast_is_ct_constant(zend_ast *ast) @@ -71,8 +71,8 @@ ZEND_API int zend_ast_is_ct_constant(zend_ast *ast) return !IS_CONSTANT_TYPE(Z_TYPE_P(ast-u.val)); } else { for (i = 0; i ast-children; i++) { - if (ast-u.child[i]) { - if (!zend_ast_is_ct_constant(ast-u.child[i])) { + if ((ast-u.child)[i]) { + if (!zend_ast_is_ct_constant((ast-u.child)[i])) { return 0; } } @@ -87,137 +87,137 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast TSRMLS_DC) switch (ast-kind) { case ZEND_ADD: - zend_ast_evaluate(op1, ast-u.child[0] TSRMLS_CC); - zend_ast_evaluate(op2, ast-u.child[1] TSRMLS_CC); + zend_ast_evaluate(op1, (ast-u.child)[0] TSRMLS_CC); + zend_ast_evaluate(op2, (ast-u.child)[1] TSRMLS_CC); add_function(result, op1, op2 TSRMLS_CC); zval_dtor(op1); zval_dtor(op2); break; case ZEND_SUB: - zend_ast_evaluate(op1, ast-u.child[0] TSRMLS_CC); - zend_ast_evaluate(op2, ast-u.child[1] TSRMLS_CC); + zend_ast_evaluate(op1, (ast-u.child)[0] TSRMLS_CC); + zend_ast_evaluate(op2, (ast-u.child)[1] TSRMLS_CC); sub_function(result, op1, op2 TSRMLS_CC); zval_dtor(op1); zval_dtor(op2); break;
[PHP-CVS] com php-src: Removed operations on constant arrays. They make no sense as constants are not allowed to be arrays. And as just properties are allowed to; no problem, we still don't need opera
Commit:18e2b1a9a930d5ae15544c5a2beed6b20d58cdee Author:Bob Weinand bobw...@hotmail.com Sun, 3 Nov 2013 12:28:00 +0100 Parents: ad967e1329ce25e80f485f77be1478f3676b9a37 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=18e2b1a9a930d5ae15544c5a2beed6b20d58cdee Log: Removed operations on constant arrays. They make no sense as constants are not allowed to be arrays. And as just properties are allowed to; no problem, we still don't need operations on any constant array. Changed paths: M Zend/zend_language_parser.y Diff: diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 65e3e0c..19d6d83 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -952,7 +952,9 @@ static_class_constant: ; static_scalar: /* compile-time evaluated scalars */ - static_scalar_value { $$ = $1; } + static_scalar_value { $$ = $1; } + | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; } + | '[' static_array_pair_list ']' { $$ = $2; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; } ; static_scalar_value: @@ -961,8 +963,6 @@ static_scalar_value: | namespace_name { zend_do_fetch_constant($$, NULL, $1, ZEND_CT, 1 TSRMLS_CC); } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING($$.u.constant); zend_do_build_namespace_name($$, $$, $3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant($$, NULL, $3, ZEND_CT, 0 TSRMLS_CC); } | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy((tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant($$, NULL, $2, ZEND_CT, 0 TSRMLS_CC); } - | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; } - | '[' static_array_pair_list ']' { $$ = $2; Z_TYPE($$.u.constant) = IS_CONSTANT_ARRAY; } | static_class_constant { $$ = $1; } | T_CLASS_C { $$ = $1; } | static_operation { $$ = $1; } -- 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/date/lib/timelib.h ext/date/php_date.c
Commit:88067b6e60a1813aa6bb97e41c2e33c19019fbf5 Author:Derick Rethans git...@derickrethans.nl Thu, 28 Nov 2013 14:30:08 + Parents: 4587ef569af91110728ed70c474af46cc88275e1 c1eb219aad2e23db5db27d887b93b06c1537fec9 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=88067b6e60a1813aa6bb97e41c2e33c19019fbf5 Log: Merge branch 'PHP-5.4' into PHP-5.5 Conflicts: ext/date/php_date.c Changed paths: MM ext/date/lib/timelib.h MM ext/date/php_date.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 ext/wddx: ext/wddx/php_wddx_api.h ext/wddx/wddx.c
Commit:ef54a95b7184899c63b4bd7be400c4621dd36360 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 20:00:27 +0100 Parents: 262fca3a39137a22c5fb237e453e68ef64dce126 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ef54a95b7184899c63b4bd7be400c4621dd36360 Log: fixed ext/wddx Changed paths: M ext/wddx/php_wddx_api.h M ext/wddx/wddx.c diff --git a/ext/wddx/php_wddx_api.h b/ext/wddx/php_wddx_api.h index 1a01945..9487c15 100644 --- a/ext/wddx/php_wddx_api.h +++ b/ext/wddx/php_wddx_api.h @@ -57,11 +57,11 @@ typedef smart_str wddx_packet; wddx_packet* php_wddx_constructor(void); voidphp_wddx_destructor(wddx_packet *packet); -voidphp_wddx_packet_start(wddx_packet *packet, char *comment, int comment_len); +voidphp_wddx_packet_start(wddx_packet *packet, char *comment, zend_str_size_int comment_len); voidphp_wddx_packet_end(wddx_packet *packet); -voidphp_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, int name_len TSRMLS_DC); -int php_wddx_deserialize_ex(char *, int, zval *return_value); +voidphp_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, zend_str_size_int name_len TSRMLS_DC); +int php_wddx_deserialize_ex(char *, zend_str_size_int, zval *return_value); #define php_wddx_gather(packet) estrndup(packet-c, packet-len) #endif /* PHP_WDDX_API_H */ diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index afeca90..8ed2d35 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -295,9 +295,9 @@ PS_SERIALIZER_DECODE_FUNC(wddx) zval *retval; zval **ent; char *key; - uint key_length; + zend_str_size_uint key_length; char tmp[128]; - ulong idx; + php_uint_t idx; int hash_type; int ret; @@ -366,7 +366,7 @@ PHP_MINFO_FUNCTION(wddx) /* {{{ php_wddx_packet_start */ -void php_wddx_packet_start(wddx_packet *packet, char *comment, int comment_len) +void php_wddx_packet_start(wddx_packet *packet, char *comment, zend_str_size_int comment_len) { php_wddx_add_chunk_static(packet, WDDX_PACKET_S); if (comment) { @@ -403,11 +403,11 @@ static void php_wddx_serialize_string(wddx_packet *packet, zval *var TSRMLS_DC) { php_wddx_add_chunk_static(packet, WDDX_STRING_S); - if (Z_STRLEN_P(var) 0) { + if (Z_STRSIZE_P(var) 0) { char *buf; size_t buf_len; - buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRLEN_P(var), buf_len, 0, ENT_QUOTES, NULL TSRMLS_CC); + buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRSIZE_P(var), buf_len, 0, ENT_QUOTES, NULL TSRMLS_CC); php_wddx_add_chunk_ex(packet, buf, buf_len); @@ -458,7 +458,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) zval **ent, *fname, **varname; zval *retval = NULL; const char *key; - ulong idx; + php_uint_t idx; char tmp_buf[WDDX_BUF_LEN]; HashTable *objhash, *sleephash; TSRMLS_FETCH(); @@ -496,15 +496,15 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) continue; } - if (zend_hash_find(objhash, Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, (void **)ent) == SUCCESS) { - php_wddx_serialize_var(packet, *ent, Z_STRVAL_PP(varname), Z_STRLEN_PP(varname) TSRMLS_CC); + if (zend_hash_find(objhash, Z_STRVAL_PP(varname), Z_STRSIZE_PP(varname)+1, (void **)ent) == SUCCESS) { + php_wddx_serialize_var(packet, *ent, Z_STRVAL_PP(varname), Z_STRSIZE_PP(varname) TSRMLS_CC); } } php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); } } else { - uint key_len; + zend_str_size_uint key_len; PHP_CLASS_ATTRIBUTES; @@ -556,12 +556,12 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr) { zval **ent; char *key; - uint key_len; + zend_str_size_uint key_len; int is_struct = 0, ent_type; - ulong idx; + php_uint_t idx; HashTable *target_hash; char tmp_buf[WDDX_BUF_LEN]; - ulong ind = 0; + php_uint_t ind = 0; int type; TSRMLS_FETCH(); @@ -624,7 +624,7 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr) /* {{{ php_wddx_serialize_var */ -void php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, int name_len TSRMLS_DC) +void php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, zend_str_size_int name_len TSRMLS_DC) { HashTable *ht; @@ -700,8 +700,8
[PHP-CVS] com php-src: fixed ext/ctype: ext/ctype/ctype.c
Commit:46448539b0482875473d66c20a8e319578e41a4d Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 09:53:00 +0100 Parents: 3f7522a652d2c90ca594cdb02b4083ce64213e46 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=46448539b0482875473d66c20a8e319578e41a4d Log: fixed ext/ctype Changed paths: M ext/ctype/ctype.c Diff: diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c index e2698f5..a7b7536 100644 --- a/ext/ctype/ctype.c +++ b/ext/ctype/ctype.c @@ -159,7 +159,7 @@ static PHP_MINFO_FUNCTION(ctype) tmp = *c; \ } \ if (Z_TYPE(tmp) == IS_STRING) { \ - char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRLEN(tmp); \ + char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRSIZE(tmp); \ if (e == p) { \ if (Z_TYPE_P(c) == IS_LONG) zval_dtor(tmp); \ RETURN_FALSE; \ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Merge branch 'master' into str_size_and_int64: Zend/Zend.dsp Zend/ZendTS.dsp Zend/zend.h Zend/zend_API.c Zend/zend_builtin_functions.c Zend/zend_compile.c Zend/zend_compile.h Ze
Commit:5ced3db9714c02d2fd40370f632f23d047f51987 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 17:27:59 +0100 Parents: a7862de2db615f351fd746bd2fb87564b9631e73 0d65cd50ddd409d37b208ae3fc5adbb7b22d1379 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5ced3db9714c02d2fd40370f632f23d047f51987 Log: Merge branch 'master' into str_size_and_int64 Conflicts: Zend/zend.h Zend/zend_hash.c Zend/zend_hash.h Zend/zend_language_parser.y Zend/zend_vm_def.h Zend/zend_vm_execute.h Changed paths: MM Zend/Zend.dsp MM Zend/ZendTS.dsp MM Zend/zend.h MM Zend/zend_API.c MM Zend/zend_builtin_functions.c MM Zend/zend_compile.c MM Zend/zend_compile.h MM Zend/zend_execute_API.c MM Zend/zend_hash.c MM Zend/zend_hash.h MM Zend/zend_language_parser.y MM Zend/zend_operators.h MM Zend/zend_ts_hash.c MM Zend/zend_ts_hash.h MM Zend/zend_vm_def.h MM Zend/zend_vm_execute.h MM configure.in MM ext/date/lib/timelib.h MM ext/date/php_date.c MM ext/reflection/php_reflection.c MM win32/build/config.w32 diff --cc Zend/zend.h index 01db626,1c86d57..9e3fc06 --- a/Zend/zend.h +++ b/Zend/zend.h @@@ -317,9 -317,10 +317,10 @@@ typedef struct _zend_object } zend_object; #include zend_object_handlers.h + #include zend_ast.h typedef union _zvalue_value { - long lval; /* long value */ + zend_int_t lval;/* long value */ double dval;/* double value */ struct { char *val; @@@ -587,8 -589,8 +589,9 @@@ typedef int (*zend_write_func_t)(const #define IS_RESOURCE 7 #define IS_CONSTANT 8 #define IS_CONSTANT_ARRAY 9 - #define IS_CALLABLE 10 + #define IS_CONSTANT_AST 10 + #define IS_CALLABLE 11 +#define IS_LONG IS_INT /* Ugly hack to support constants as static array indices */ #define IS_CONSTANT_TYPE_MASK 0x00f diff --cc Zend/zend_compile.c index 3cc95b5,8f870c6..8f964fb --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@@ -1908,14 -1908,14 +1908,14 @@@ void zend_do_receive_param(zend_uchar o } } else { cur_arg_info-type_hint = IS_OBJECT; - if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type-u.constant), Z_STRLEN(class_type-u.constant))) { + if (ZEND_FETCH_CLASS_DEFAULT == zend_get_class_fetch_type(Z_STRVAL(class_type-u.constant), Z_STRSIZE(class_type-u.constant))) { zend_resolve_class_name(class_type TSRMLS_CC); } - Z_STRVAL(class_type-u.constant) = (char*)zend_new_interned_string(Z_STRVAL(class_type-u.constant), Z_STRLEN(class_type-u.constant) + 1, 1 TSRMLS_CC); + Z_STRVAL(class_type-u.constant) = (char*)zend_new_interned_string(Z_STRVAL(class_type-u.constant), Z_STRSIZE(class_type-u.constant) + 1, 1 TSRMLS_CC); cur_arg_info-class_name = Z_STRVAL(class_type-u.constant); - cur_arg_info-class_name_len = Z_STRLEN(class_type-u.constant); + cur_arg_info-class_name_len = Z_STRSIZE(class_type-u.constant); if (op == ZEND_RECV_INIT) { - if (Z_TYPE(initialization-u.constant) == IS_NULL || (Z_TYPE(initialization-u.constant) == IS_CONSTANT !strcasecmp(Z_STRVAL(initialization-u.constant), NULL))) { + if (Z_TYPE(initialization-u.constant) == IS_NULL || (Z_TYPE(initialization-u.constant) == IS_CONSTANT !strcasecmp(Z_STRVAL(initialization-u.constant), NULL)) || Z_TYPE(initialization-u.constant) == IS_CONSTANT_AST) { cur_arg_info-allow_null = 1; } else { zend_error_noreturn(E_COMPILE_ERROR, Default value for parameters with a class type hint can only be NULL); @@@ -5778,14 -5777,28 +5777,28 @@@ void zend_do_add_static_array_element(z case IS_CONSTANT: /* Ugly hack to denote that this value has a constant index */ Z_TYPE_P(element) |= IS_CONSTANT_INDEX; - Z_STRVAL(offset-u.constant) = erealloc(Z_STRVAL(offset-u.constant), Z_STRLEN(offset-u.constant)+3); - Z_STRVAL(offset-u.constant)[Z_STRLEN(offset-u.constant)+1] = Z_TYPE(offset-u.constant); - Z_STRVAL(offset-u.constant)[Z_STRLEN(offset-u.constant)+2] = 0; -
Re: [PHP-CVS] com php-src: Don't check argument types for internal functions without type hinting: Zend/zend_API.c Zend/zend_compile.h Zend/zend_vm_def.h Zend/zend_vm_execute.h
Hi Nikita, I wouldn't object, but I ask you to wait a bit (at least till New Year). May be we would come back with proposal of some kind of scalar type hinting. Also, currently, zend_parse_parameters() takes significant time (about 4% on wordpress-3.6.1 home page) and may be it makes sense to use some chipper parameter parsing mechanism. Thanks. Dmitry. On Thu, Nov 28, 2013 at 12:06 PM, Nikita Popov nikita@gmail.com wrote: On Thu, Nov 28, 2013 at 8:44 AM, Dmitry Stogov dmi...@php.net wrote: Commit:57c1335fec064d8022d3d86b01ceb4eea0a027a7 Author:Dmitry Stogov dmi...@zend.com Thu, 28 Nov 2013 11:44:14 +0400 Parents: fcb98cbce8b85326763f352cb789581b55d85ec8 Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=57c1335fec064d8022d3d86b01ceb4eea0a027a7 Log: Don't check argument types for internal functions without type hinting Changed paths: M Zend/zend_API.c M Zend/zend_compile.h M Zend/zend_vm_def.h M Zend/zend_vm_execute.h Diff: diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 56b1fda..23729ea 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2138,6 +2138,19 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio str_efree(lowercase_name); break; } + + /* If types of arguments have to be checked */ + if (reg_function-common.arg_info reg_function-common.num_args) { + int i; + for (i = 0; i reg_function-common.num_args; i++) { + if (reg_function-common.arg_info[i].class_name || + reg_function-common.arg_info[i].type_hint) { + reg_function-common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS; + break; + } + } + } + if (scope) { /* Look for ctor, dtor, clone * If it's an old-style constructor, store it only if we don't have diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 23c5b22..5e28488 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -212,6 +212,9 @@ typedef struct _zend_try_catch_element { #define ZEND_ACC_RETURN_REFERENCE 0x400 #define ZEND_ACC_DONE_PASS_TWO 0x800 +/* function has arguments with type hinting */ +#define ZEND_ACC_HAS_TYPE_HINTS0x1000 + char *zend_visibility_string(zend_uint fn_flags); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 45cfe90..6eca6d0 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1951,7 +1951,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) LOAD_OPLINE(); if (fbc-type == ZEND_INTERNAL_FUNCTION) { - if (fbc-common.arg_info) { + if (fbc-common.fn_flags ZEND_ACC_HAS_TYPE_HINTS) { zend_uint i=0; zval **p = (zval**)EX(function_state).arguments; ulong arg_count = opline-extended_value; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 107e460..dcb1183 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -530,7 +530,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR LOAD_OPLINE(); if (fbc-type == ZEND_INTERNAL_FUNCTION) { - if (fbc-common.arg_info) { + if (fbc-common.fn_flags ZEND_ACC_HAS_TYPE_HINTS) { zend_uint i=0; zval **p = (zval**)EX(function_state).arguments; ulong arg_count = opline-extended_value; I wonder whether we should drop arginfo type checking for internal functions altogether. Normally the checking is handled by zpp and doing the same checks in arginfo is just a perf loss. To avoid that nearly no internal functions specify type hints in arginfo. They are usually written commented-outed next to a generic arg (e.g. see http://lxr.php.net/xref/PHP_TRUNK/ext/standard/basic_functions.c#218). Disabling arginfo checks for internal functions would allow us to have better reflection information about argument types without incurring a perf loss. Nikita
[PHP-CVS] com php-src: fixed ext/xsl: ext/xsl/php_xsl.h ext/xsl/xsltprocessor.c
Commit:d9a036cc3065aeb45cd818ce810e316780a458b7 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 19:18:38 +0100 Parents: 9e5c10e487db678be9c37d729de4cda1f1888d12 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d9a036cc3065aeb45cd818ce810e316780a458b7 Log: fixed ext/xsl Changed paths: M ext/xsl/php_xsl.h M ext/xsl/xsltprocessor.c Diff: diff --git a/ext/xsl/php_xsl.h b/ext/xsl/php_xsl.h index e1a792e..dd34210 100644 --- a/ext/xsl/php_xsl.h +++ b/ext/xsl/php_xsl.h @@ -65,7 +65,7 @@ typedef struct _xsl_object { HashTable *node_list; php_libxml_node_object *doc; char *profiling; - long securityPrefs; + php_int_t securityPrefs; int securityPrefsSet; } xsl_object; diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index af11104..2e0ed1f 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -137,7 +137,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS int parsize; zval **value; char *xpath_expr, *string_key = NULL; - ulong num_key; + php_uint_t num_key; char **params = NULL; int i = 0; @@ -162,7 +162,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS if (!xpath_params) { xpath_expr = php_xsl_xslt_string_to_xpathexpr(Z_STRVAL_PP(value) TSRMLS_CC); } else { - xpath_expr = estrndup(Z_STRVAL_PP(value), Z_STRLEN_PP(value)); + xpath_expr = estrndup(Z_STRVAL_PP(value), Z_STRSIZE_PP(value)); } if (xpath_expr) { params[i++] = string_key; @@ -644,7 +644,8 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc) zval *id, *docp = NULL; xmlDoc *newdocp; xsltStylesheetPtr sheetp; - int ret, ret_class_len=0; + int ret; + zend_str_size_int ret_class_len=0; char *ret_class = NULL; xsl_object *intern; @@ -652,7 +653,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc) intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); sheetp = (xsltStylesheetPtr) intern-ptr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o|s!, docp, ret_class, ret_class_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, o|S!, docp, ret_class, ret_class_len) == FAILURE) { RETURN_FALSE; } @@ -701,7 +702,8 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri) zval *id, *docp = NULL; xmlDoc *newdocp; xsltStylesheetPtr sheetp; - int ret, uri_len; + int ret; + zend_str_size_int uri_len; char *uri; xsl_object *intern; @@ -709,7 +711,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri) intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); sheetp = (xsltStylesheetPtr) intern-ptr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, op, docp, uri, uri_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, oP, docp, uri, uri_len) == FAILURE) { RETURN_FALSE; } @@ -772,11 +774,11 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter) zval *array_value, **entry, *new_string; xsl_object *intern; char *string_key, *name, *value, *namespace; - ulong idx; - int string_key_len, namespace_len, name_len, value_len; + php_uint_t idx; + zend_str_size_int string_key_len, namespace_len, name_len, value_len; DOM_GET_THIS(id); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, sa, namespace, namespace_len, array_value) == SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, Sa, namespace, namespace_len, array_value) == SUCCESS) { intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value)); @@ -798,7 +800,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter) } RETURN_TRUE; - } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, sss, namespace, namespace_len, name, name_len, value, value_len) == SUCCESS) { + } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, SSS, namespace, namespace_len, name, name_len, value, value_len) == SUCCESS) { intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); @@ -819,14 +821,14 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter) PHP_FUNCTION(xsl_xsltprocessor_get_parameter) { zval *id; - int name_len = 0, namespace_len = 0; +
[PHP-CVS] com php-src: Fixed Forward Transition construction of DateTime objects.: ext/date/php_date.c ext/date/tests/forward-transition-construction.phpt
Commit:44a9e6b4843de686eab2e2bfa66bdf17ed685d7e Author:Derick Rethans git...@derickrethans.nl Sun, 31 Mar 2013 18:11:35 +0100 Parents: fb0c2cf2245838cba1bd9318925d67a127c7b085 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=44a9e6b4843de686eab2e2bfa66bdf17ed685d7e Log: Fixed Forward Transition construction of DateTime objects. This fixes the issue in https://wiki.php.net/rfc/datetime_and_daylight_saving_time#forward_transitions There is a period during transition to DST where a time (such as 02:30) does not exist. PHP already calculated the correct timestamp for this, but failed to rounded forward to the existing correct hour value. Changed paths: M ext/date/php_date.c A ext/date/tests/forward-transition-construction.phpt Diff: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index b7da07c..05ac672 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2487,6 +2487,7 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, timelib_fill_holes(dateobj-time, now, TIMELIB_NO_CLONE); timelib_update_ts(dateobj-time, tzi); + timelib_update_from_sse(dateobj-time); dateobj-time-have_relative = 0; diff --git a/ext/date/tests/forward-transition-construction.phpt b/ext/date/tests/forward-transition-construction.phpt new file mode 100644 index 000..8f195a5 --- /dev/null +++ b/ext/date/tests/forward-transition-construction.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test for Date/Time construction during a forward DST transition +--FILE-- +?php +date_default_timezone_set('America/New_York'); + +$date = new DateTime('2010-03-14 01:30:00'); +echo $date-format('Y-m-d H:i:s T/e - U') . \n; + +$date = new DateTime('2010-03-14 02:00:00'); +echo $date-format('Y-m-d H:i:s T/e - U') . \n; + +$date = new DateTime('2010-03-14 02:30:00'); +echo $date-format('Y-m-d H:i:s T/e - U') . \n; + +$date = new DateTime('2010-03-14 03:00:00'); +echo $date-format('Y-m-d H:i:s T/e - U') . \n; + +$date = new DateTime('2010-03-14 03:30:00'); +echo $date-format('Y-m-d H:i:s T/e - U') . \n; +? +--EXPECT-- +2010-03-14 01:30:00 EST/America/New_York - 1268548200 +2010-03-14 03:00:00 EDT/America/New_York - 126855 +2010-03-14 03:30:00 EDT/America/New_York - 1268551800 +2010-03-14 03:00:00 EDT/America/New_York - 126855 +2010-03-14 03:30:00 EDT/America/New_York - 1268551800 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: fixed ext/zip: ext/zip/php_zip.c ext/zip/php_zip.h ext/zip/zip_stream.c
Commit:9e5c10e487db678be9c37d729de4cda1f1888d12 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 19:02:34 +0100 Parents: d8fbc23002b4a6edf5b0684f4a1aa560925cf653 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9e5c10e487db678be9c37d729de4cda1f1888d12 Log: fixed ext/zip Changed paths: M ext/zip/php_zip.c M ext/zip/php_zip.h M ext/zip/zip_stream.c diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index cd1d7cd..b428f21 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -52,11 +52,11 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_close); #endif #if PHP_VERSION_ID 50400 -#define ARG_PATH s +#define ARG_PATH S #define KEY_ARG_DC #define KEY_ARG_CC #else -#define ARG_PATH p +#define ARG_PATH P #define KEY_ARG_DC , const zend_literal *key #define KEY_ARG_CC , key #endif @@ -101,7 +101,7 @@ static int le_zip_entry; if (zip_set_file_comment(intern, index, NULL, 0) 0) { \ RETURN_FALSE; \ } \ - } else if (zip_set_file_comment(intern, index, comment, comment_len) 0) { \ + } else if (zip_set_file_comment(intern, index, comment, (int)comment_len) 0) { \ RETURN_FALSE; \ } \ RETURN_TRUE; @@ -151,13 +151,15 @@ static char * php_zip_make_relative_path(char *path, int path_len) /* {{{ */ #ifdef PHP_ZIP_USE_OO /* {{{ php_zip_extract_file */ -static int php_zip_extract_file(struct zip * za, char *dest, char *file, int file_len TSRMLS_DC) +static int php_zip_extract_file(struct zip * za, char *dest, char *file, zend_str_size_int file_len TSRMLS_DC) { php_stream_statbuf ssb; struct zip_file *zf; struct zip_stat sb; char b[8192]; - int n, len, ret; + php_int_t n; + zend_str_size_int len; + int ret; php_stream *stream; char *fullpath; char *file_dirname_fullpath; @@ -346,12 +348,12 @@ static int php_zip_add_file(struct zip *za, const char *filename, size_t filenam } /* }}} */ -static int php_zip_parse_options(zval *options, long *remove_all_path, - char **remove_path, int *remove_path_len, char **add_path, int *add_path_len TSRMLS_DC) /* {{{ */ +static int php_zip_parse_options(zval *options, php_int_t *remove_all_path, + char **remove_path, zend_str_size_int *remove_path_len, char **add_path, zend_str_size_int *add_path_len TSRMLS_DC) /* {{{ */ { zval **option; if (zend_hash_find(HASH_OF(options), remove_all_path, sizeof(remove_all_path), (void **)option) == SUCCESS) { - long opt; + php_int_t opt; if (Z_TYPE_PP(option) != IS_LONG) { zval tmp = **option; zval_copy_ctor(tmp); @@ -370,17 +372,17 @@ static int php_zip_parse_options(zval *options, long *remove_all_path, return -1; } - if (Z_STRLEN_PP(option) 1) { + if (Z_STRSIZE_PP(option) 1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, Empty string given as remove_path option); return -1; } - if (Z_STRLEN_PP(option) = MAXPATHLEN) { + if (Z_STRSIZE_PP(option) = MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, remove_path string is too long (max: %i, %i given), - MAXPATHLEN - 1, Z_STRLEN_PP(option)); + MAXPATHLEN - 1, Z_STRSIZE_PP(option)); return -1; } - *remove_path_len = Z_STRLEN_PP(option); + *remove_path_len = Z_STRSIZE_PP(option); *remove_path = Z_STRVAL_PP(option); } @@ -390,17 +392,17 @@ static int php_zip_parse_options(zval *options, long *remove_all_path, return -1; } - if (Z_STRLEN_PP(option) 1) { + if (Z_STRSIZE_PP(option) 1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, Empty string given as the add_path option); return -1; } - if (Z_STRLEN_PP(option) = MAXPATHLEN) { + if (Z_STRSIZE_PP(option) = MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, add_path string too long (max: %i, %i given), - MAXPATHLEN - 1, Z_STRLEN_PP(option)); + MAXPATHLEN - 1, Z_STRSIZE_PP(option)); return -1; } - *add_path_len = Z_STRLEN_PP(option); + *add_path_len = Z_STRSIZE_PP(option); *add_path = Z_STRVAL_PP(option); } return 1; @@ -476,10 +478,10 @@ static char * php_zipobj_get_filename(ze_zip_object *obj TSRMLS_DC) /*
[PHP-CVS] com php-src: Renaming: Zend/zend_ast.c Zend/zend_ast.h Zend/zend_language_parser.y
Commit:e0135014c3b4edaf67312677c440a93133fe6a0c Author:Dmitry Stogov dmi...@zend.com Thu, 7 Nov 2013 10:22:49 +0400 Parents: 9647c61dc101b9d460259fedb3731026f0390eeb Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e0135014c3b4edaf67312677c440a93133fe6a0c Log: Renaming Changed paths: M Zend/zend_ast.c M Zend/zend_ast.h M Zend/zend_language_parser.y diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 7ebb8d2..7495da3 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -23,7 +23,7 @@ #include zend_API.h #include zend_operators.h -ZEND_API zend_ast *zend_ast_create_constant_node(zval *zv) +ZEND_API zend_ast *zend_ast_create_constant(zval *zv) { zend_ast *node = emalloc(sizeof(zend_ast) + sizeof(zval)); node-kind = ZEND_CONST; @@ -33,7 +33,7 @@ ZEND_API zend_ast *zend_ast_create_constant_node(zval *zv) return node; } -ZEND_API zend_ast* zend_ast_create_node1(uint kind, zend_ast *op0) +ZEND_API zend_ast* zend_ast_create_unary(uint kind, zend_ast *op0) { zend_ast *node = emalloc(sizeof(zend_ast)); node-kind = kind; @@ -42,7 +42,7 @@ ZEND_API zend_ast* zend_ast_create_node1(uint kind, zend_ast *op0) return node; } -ZEND_API zend_ast* zend_ast_create_node2(uint kind, zend_ast *op0, zend_ast *op1) +ZEND_API zend_ast* zend_ast_create_binary(uint kind, zend_ast *op0, zend_ast *op1) { zend_ast *node = emalloc(sizeof(zend_ast) + sizeof(zend_ast*)); node-kind = kind; @@ -52,7 +52,7 @@ ZEND_API zend_ast* zend_ast_create_node2(uint kind, zend_ast *op0, zend_ast *op1 return node; } -ZEND_API zend_ast* zend_ast_create_node3(uint kind, zend_ast *op0, zend_ast *op1, zend_ast *op2) +ZEND_API zend_ast* zend_ast_create_ternary(uint kind, zend_ast *op0, zend_ast *op1, zend_ast *op2) { zend_ast *node = emalloc(sizeof(zend_ast) + sizeof(zend_ast*) * 2); node-kind = kind; @@ -251,7 +251,7 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast TSRMLS_DC) } zval_dtor(op1); break; - case ZEND_TERNARY: + case ZEND_SELECT: zend_ast_evaluate(op1, ast-u.child[0] TSRMLS_CC); if (zend_is_true(op1)) { if (!ast-u.child[1]) { @@ -287,22 +287,22 @@ ZEND_API zend_ast *zend_ast_copy(zend_ast *ast) if (ast == NULL) { return NULL; } else if (ast-kind == ZEND_CONST) { - zend_ast *node = zend_ast_create_constant_node(ast-u.val); + zend_ast *node = zend_ast_create_constant(ast-u.val); zval_copy_ctor(node-u.val); return node; } else { switch (ast-children) { case 1: - return zend_ast_create_node1( + return zend_ast_create_unary( ast-kind, zend_ast_copy(ast-u.child[0])); case 2: - return zend_ast_create_node2( + return zend_ast_create_binary( ast-kind, zend_ast_copy(ast-u.child[0]), zend_ast_copy(ast-u.child[1])); case 3: - return zend_ast_create_node3( + return zend_ast_create_ternary( ast-kind, zend_ast_copy(ast-u.child[0]), zend_ast_copy(ast-u.child[1]), diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h index 4c94cf8..9cdcbf5 100644 --- a/Zend/zend_ast.h +++ b/Zend/zend_ast.h @@ -26,15 +26,15 @@ typedef struct _zend_ast zend_ast; #include zend.h -typedef enum _zend_ast_node_kind { - /* first 256 node kinds are reserved for opcodes */ +typedef enum _zend_ast_kind { + /* first 256 kinds are reserved for opcodes */ ZEND_CONST = 256, ZEND_BOOL_AND, ZEND_BOOL_OR, - ZEND_TERNARY, + ZEND_SELECT, ZEND_UNARY_PLUS, ZEND_UNARY_MINUS, -} zend_ast_ode_kind; +} zend_ast_kind; struct _zend_ast { unsigned short kind; @@ -45,11 +45,11 @@ struct _zend_ast { } u; }; -ZEND_API zend_ast *zend_ast_create_constant_node(zval *zv); +ZEND_API zend_ast *zend_ast_create_constant(zval *zv); -ZEND_API zend_ast *zend_ast_create_node1(uint kind, zend_ast *op0); -ZEND_API zend_ast *zend_ast_create_node2(uint kind, zend_ast *op0, zend_ast *op1); -ZEND_API zend_ast *zend_ast_create_node3(uint kind, zend_ast *op0, zend_ast *op1, zend_ast *op2); +ZEND_API zend_ast *zend_ast_create_unary(uint kind, zend_ast *op0); +ZEND_API zend_ast *zend_ast_create_binary(uint kind,
[PHP-CVS] com php-src: Fixed a few DST changeover issues.: ext/date/lib/interval.c ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt ext/date/tests/rfc-datetime_and_daylight_saving_ti
Commit:582f6e529e843b412d582023bf0270e47b1aa468 Author:Derick Rethans git...@derickrethans.nl Thu, 20 Jun 2013 09:28:23 +0100 Parents: 5d0c526199add0e4f054a57db29d882c8ad89a23 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=582f6e529e843b412d582023bf0270e47b1aa468 Log: Fixed a few DST changeover issues. Changed paths: M ext/date/lib/interval.c M ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt M ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt M ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt M ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt Diff: diff --git a/ext/date/lib/interval.c b/ext/date/lib/interval.c index 7fa1fc5..dce62f3 100644 --- a/ext/date/lib/interval.c +++ b/ext/date/lib/interval.c @@ -111,6 +111,14 @@ timelib_time *timelib_add(timelib_time *old_time, timelib_rel_time *interval) t-sse_uptodate = 0; timelib_update_ts(t, NULL); + +// printf(%lld %lld %d\n, old_time-dst, t-dst, (t-sse - old_time-sse)); + /* Adjust for backwards DST changeover */ + if (old_time-dst == 1 t-dst == 0 !interval-y !interval-m !interval-d) { + t-sse -= old_time-z; + t-sse += t-z; + } + timelib_update_from_sse(t); t-have_relative = 0; @@ -137,6 +145,18 @@ timelib_time *timelib_sub(timelib_time *old_time, timelib_rel_time *interval) t-sse_uptodate = 0; timelib_update_ts(t, NULL); + + /* Adjust for backwards DST changeover */ + if (old_time-dst == 1 t-dst == 0 !interval-y !interval-m !interval-d) { + t-sse -= old_time-z; + t-sse += t-z; + } + /* Adjust for forwards DST changeover */ + if (old_time-dst == 0 t-dst == 1 !interval-y !interval-m !interval-d ) { + t-sse -= old_time-z; + t-sse += t-z; + } + timelib_update_from_sse(t); t-have_relative = 0; diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt index 45db229..fdbe96d 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt @@ -90,7 +90,7 @@ ba4 2010-11-06 04:30:00 EDT America/New_York + PT23H = 2010-11-07 02:30:00 EST A ba5 2010-11-06 04:30:00 EDT America/New_York + PT22H = 2010-11-07 01:30:00 EST America/New_York ba6 2010-11-06 04:30:00 EDT America/New_York + PT21H = 2010-11-07 01:30:00 EDT America/New_York ba7 2010-11-06 01:30:00 EDT America/New_York + P1D = 2010-11-07 01:30:00 EDT America/New_York -ba8 2010-11-06 01:30:00 EDT America/New_York + P1DT1H = 2010-11-07 01:30:00 EST America/New_York +ba8 2010-11-06 01:30:00 EDT America/New_York + P1DT1H = 2010-11-07 02:30:00 EST America/New_York ba9 2010-11-06 04:30:00 EDT America/New_York + PT25H = 2010-11-07 04:30:00 EST America/New_York ba10 2010-11-06 03:30:00 EDT America/New_York + P1D = 2010-11-07 03:30:00 EST America/New_York ba11 2010-11-06 02:30:00 EDT America/New_York + P1D = 2010-11-07 02:30:00 EST America/New_York diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt index c2fe4bf..62dab5d 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt @@ -25,7 +25,7 @@ $end = new DateTime('2010-11-07 05:30:00'); $end-setTimeZone($tz); $start = new DateTime('2010-11-06 04:30:59'); echo 'bd0 ' . $end-format($date_format) . ' - ' . $start-format($date_format) - . ' = ' . $start-diff($end)-format('PT%hH%iM%sS') . \n; + . ' = ' . $start-diff($end)-format('P%dDT%hH%iM%sS') . \n; $end = new DateTime('2010-11-07 01:30:00 EST'); $end-setTimeZone($tz); diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt index 0dd384a..138c68f 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt @@ -6,6 +6,7 @@ Daniel Convissor dani...@php.net ?php date_default_timezone_set('America/New_York'); +$tz = new DateTimeZone('America/New_York'); $date_format = 'Y-m-d H:i:s T e'; $interval_format = 'P%dDT%hH'; diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt index 4b3c254..f8066ae 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt @@ -62,4 +62,4 @@ fs3 2010-03-14 03:30:00 EDT America/New_York - PT22H = 2010-03-13 04:30:00 EST A fs4 2010-03-14 01:30:00
[PHP-CVS] com php-src: Added a few more operators: Zend/tests/constant_expressions.phpt Zend/zend_compile.h Zend/zend_language_parser.y Zend/zend_operators.c Zend/zend_operators.h
Commit:ad967e1329ce25e80f485f77be1478f3676b9a37 Author:Bob Weinand bobw...@hotmail.com Sun, 3 Nov 2013 01:58:39 +0100 Parents: 82cd3779f4644a903b6dbbc966e72ebc54c9d694 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ad967e1329ce25e80f485f77be1478f3676b9a37 Log: Added a few more operators Changed paths: M Zend/tests/constant_expressions.phpt M Zend/zend_compile.h M Zend/zend_language_parser.y M Zend/zend_operators.c M Zend/zend_operators.h diff --git a/Zend/tests/constant_expressions.phpt b/Zend/tests/constant_expressions.phpt index 441b9a6..7dea0d8 100644 --- a/Zend/tests/constant_expressions.phpt +++ b/Zend/tests/constant_expressions.phpt @@ -14,12 +14,26 @@ This is a test string ENDOFSTRING; const T_9 = ~-1; const T_10 = (-1?:1) + (0?2:3); +const T_11 = 1 0; +const T_12 = 1 and 1; +const T_13 = 0 || 0; +const T_14 = 1 or 0; +const T_15 = 1 xor 1; +const T_16 = 1 xor 0; +const T_17 = 1 0; +const T_18 = 0 = 0; +const T_19 = 1 0; +const T_20 = 1 = 0; +const T_21 = 1 === 1; +const T_22 = 1 !== 1; +const T_23 = 0 != 0; +const T_24 = 1 == 1; // Test order of operations -const T_11 = 1 + 2 * 3; +const T_25 = 1 + 2 * 3; // Test for memory leaks -const T_12 = 1 + 2 + 3; +const T_26 = 1 + 2 + 3; var_dump(T_1); var_dump(T_2); @@ -33,6 +47,20 @@ var_dump(T_9); var_dump(T_10); var_dump(T_11); var_dump(T_12); +var_dump(T_13); +var_dump(T_14); +var_dump(T_15); +var_dump(T_16); +var_dump(T_17); +var_dump(T_18); +var_dump(T_19); +var_dump(T_20); +var_dump(T_21); +var_dump(T_22); +var_dump(T_23); +var_dump(T_24); +var_dump(T_25); +var_dump(T_26); ? --EXPECT-- int(2) @@ -45,5 +73,19 @@ int(8) string(21) This is a test string int(0) int(2) +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) +bool(true) int(7) int(6) diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index bbc6e47..b80a7cb 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -722,6 +722,10 @@ int zend_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC); #define ZEND_OP_DATA 137 +/* Pseudo-opcodes for internal object overloading */ +#define ZEND_BOOL_AND -1 +#define ZEND_BOOL_OR -2 + /* END: OPCODES */ /* class fetches */ diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index af00f2e..65e3e0c 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -970,23 +970,36 @@ static_scalar_value: static_operation: static_scalar_value '+' static_scalar_value { zend_ast_add_binary($$.u.constant, add_function, $1.u.constant, $3.u.constant TSRMLS_CC); } - | static_scalar_value '-' static_scalar_value { zend_ast_add_binary($$.u.constant, sub_function, $1.u.constant, $3.u.constant TSRMLS_CC); } + | static_scalar_value '-' static_scalar_value { zend_ast_add_binary($$.u.constant, sub_function, $1.u.constant, $3.u.constant TSRMLS_CC); } | static_scalar_value '*' static_scalar_value { zend_ast_add_binary($$.u.constant, mul_function, $1.u.constant, $3.u.constant TSRMLS_CC); } - | static_scalar_value '/' static_scalar_value { zend_ast_add_binary($$.u.constant, div_function, $1.u.constant, $3.u.constant TSRMLS_CC); } - | static_scalar_value '%' static_scalar_value { zend_ast_add_binary($$.u.constant, mod_function, $1.u.constant, $3.u.constant TSRMLS_CC); } - | '!' static_scalar_value { zend_ast_add_unary($$.u.constant, boolean_not_function, $2.u.constant TSRMLS_CC); } - | '~' static_scalar_value { zend_ast_add_unary($$.u.constant, bitwise_not_function, $2.u.constant TSRMLS_CC); } - | static_scalar_value '|' static_scalar_value { zend_ast_add_binary($$.u.constant, bitwise_or_function, $1.u.constant, $3.u.constant TSRMLS_CC); } - | static_scalar_value '' static_scalar_value { zend_ast_add_binary($$.u.constant, bitwise_and_function, $1.u.constant, $3.u.constant TSRMLS_CC); } - | static_scalar_value '^' static_scalar_value { zend_ast_add_binary($$.u.constant, bitwise_xor_function, $1.u.constant, $3.u.constant TSRMLS_CC); } - | static_scalar_value T_SL static_scalar_value { zend_ast_add_binary($$.u.constant, shift_left_function, $1.u.constant, $3.u.constant TSRMLS_CC); } - | static_scalar_value T_SR static_scalar_value { zend_ast_add_binary($$.u.constant, shift_right_function, $1.u.constant, $3.u.constant TSRMLS_CC); } - | static_scalar_value '.' static_scalar_value { zend_ast_add_binary($$.u.constant, concat_function, $1.u.constant, $3.u.constant TSRMLS_CC); } + | static_scalar_value '/' static_scalar_value { zend_ast_add_binary($$.u.constant, div_function, $1.u.constant, $3.u.constant TSRMLS_CC); } + |
[PHP-CVS] com php-src: basic fixes for ext/exif: ext/exif/exif.c
Commit:fd7d31973ac0a50c415fae9acf891c52f9e4779f Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 14:36:20 +0100 Parents: 4e2ddbc397f74c33c6f3514aede4e8d76bc54f53 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fd7d31973ac0a50c415fae9acf891c52f9e4779f Log: basic fixes for ext/exif Changed paths: M ext/exif/exif.c Diff: diff --git a/ext/exif/exif.c b/ext/exif/exif.c index f886bb4..8b3b8f7 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -2337,10 +2337,10 @@ static char * exif_get_markername(int marker) Get headername for index or false if not defined */ PHP_FUNCTION(exif_tagname) { - long tag; + php_int_t tag; char *szTemp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, tag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, i, tag) == FAILURE) { return; } @@ -3845,7 +3845,7 @@ static int exif_discard_imageinfo(image_info_type *ImageInfo) static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_all TSRMLS_DC) { int ret; - struct stat st; + zend_stat_t st; /* Start with an empty image information structure. */ memset(ImageInfo, 0, sizeof(*ImageInfo)); @@ -3907,14 +3907,14 @@ static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_t PHP_FUNCTION(exif_read_data) { char *p_name, *p_sections_needed = NULL; - int p_name_len, p_sections_needed_len = 0; + zend_str_size_int p_name_len, p_sections_needed_len = 0; zend_bool sub_arrays=0, read_thumbnail=0, read_all=0; int i, ret, sections_needed=0; image_info_type ImageInfo; char tmp[64], *sections_str, *s; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, p|sbb, p_name, p_name_len, p_sections_needed, p_sections_needed_len, sub_arrays, read_thumbnail) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, P|Sbb, p_name, p_name_len, p_sections_needed, p_sections_needed_len, sub_arrays, read_thumbnail) == FAILURE) { return; } @@ -4086,7 +4086,8 @@ PHP_FUNCTION(exif_thumbnail) { zval *p_width = 0, *p_height = 0, *p_imagetype = 0; char *p_name; - int p_name_len, ret, arg_c = ZEND_NUM_ARGS(); + zend_str_size_int p_name_len; + int ret, arg_c = ZEND_NUM_ARGS(); image_info_type ImageInfo; memset(ImageInfo, 0, sizeof(ImageInfo)); @@ -4095,7 +4096,7 @@ PHP_FUNCTION(exif_thumbnail) WRONG_PARAM_COUNT; } - if (zend_parse_parameters(arg_c TSRMLS_CC, p|z/z/z/, p_name, p_name_len, p_width, p_height, p_imagetype) == FAILURE) { + if (zend_parse_parameters(arg_c TSRMLS_CC, P|z/z/z/, p_name, p_name_len, p_width, p_height, p_imagetype) == FAILURE) { return; } @@ -4149,11 +4150,11 @@ PHP_FUNCTION(exif_thumbnail) PHP_FUNCTION(exif_imagetype) { char *imagefile; - int imagefile_len; + zend_str_size_int imagefile_len; php_stream * stream; int itype = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, imagefile, imagefile_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S, imagefile, imagefile_len) == FAILURE) { return; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: fixed ext/fileinfo: ext/fileinfo/fileinfo.c ext/fileinfo/libmagic/apprentice.c ext/fileinfo/libmagic/cdf.c ext/fileinfo/libmagic/compress.c ext/fileinfo/libmagic/elfclass.h ext/
Commit:57db68e03d46da1b1a2244e001550739c8eec468 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 23:44:24 +0100 Parents: ef54a95b7184899c63b4bd7be400c4621dd36360 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=57db68e03d46da1b1a2244e001550739c8eec468 Log: fixed ext/fileinfo XXX update libmagic.patch Changed paths: M ext/fileinfo/fileinfo.c M ext/fileinfo/libmagic/apprentice.c M ext/fileinfo/libmagic/cdf.c M ext/fileinfo/libmagic/compress.c M ext/fileinfo/libmagic/elfclass.h M ext/fileinfo/libmagic/file.h M ext/fileinfo/libmagic/fsmagic.c M ext/fileinfo/libmagic/funcs.c M ext/fileinfo/libmagic/readcdf.c M ext/fileinfo/libmagic/readelf.c M ext/fileinfo/libmagic/softmagic.c diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 799891e..9d6bf6a 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -44,7 +44,7 @@ /* {{{ macros and type definitions */ struct php_fileinfo { - long options; + php_int_t options; struct magic_set *magic; }; @@ -177,7 +177,7 @@ zend_function_entry finfo_class_functions[] = { /* }}} */ #define FINFO_SET_OPTION(magic, options) \ - if (magic_setflags(magic, options) == -1) { \ + if (magic_setflags(magic, (int)options) == -1) { \ php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed to set option '%ld' %d:%s, \ options, magic_errno(magic), magic_error(magic)); \ RETURN_FALSE; \ @@ -289,14 +289,14 @@ PHP_MINFO_FUNCTION(fileinfo) Create a new fileinfo resource. */ PHP_FUNCTION(finfo_open) { - long options = MAGIC_NONE; + php_int_t options = MAGIC_NONE; char *file = NULL; - int file_len = 0; + zend_str_size_int file_len = 0; struct php_fileinfo *finfo; FILEINFO_DECLARE_INIT_OBJECT(object) char resolved_path[MAXPATHLEN]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |lp, options, file, file_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |iP, options, file, file_len) == FAILURE) { FILEINFO_DESTROY_OBJECT(object); RETURN_FALSE; } @@ -380,18 +380,18 @@ PHP_FUNCTION(finfo_close) Set libmagic configuration options. */ PHP_FUNCTION(finfo_set_flags) { - long options; + php_int_t options; struct php_fileinfo *finfo; zval *zfinfo; FILEINFO_DECLARE_INIT_OBJECT(object) if (object) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, i, options) == FAILURE) { RETURN_FALSE; } FILEINFO_FROM_OBJECT(finfo, object); } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rl, zfinfo, options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ri, zfinfo, options) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, zfinfo, -1, file_info, le_fileinfo); @@ -410,9 +410,9 @@ PHP_FUNCTION(finfo_set_flags) static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mimetype_emu) /* {{{ */ { - long options = 0; + php_int_t options = 0; char *ret_val = NULL, *buffer = NULL; - int buffer_len; + zend_str_size_int buffer_len; struct php_fileinfo *finfo = NULL; zval *zfinfo, *zcontext = NULL; zval *what; @@ -431,7 +431,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime switch (Z_TYPE_P(what)) { case IS_STRING: buffer = Z_STRVAL_P(what); - buffer_len = Z_STRLEN_P(what); + buffer_len = Z_STRSIZE_P(what); mode = FILEINFO_MODE_FILE; break; @@ -450,13 +450,13 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime goto common; } } else if (object) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|lr, buffer, buffer_len, options, zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S|ir, buffer, buffer_len, options, zcontext) == FAILURE) { RETURN_FALSE; } FILEINFO_FROM_OBJECT(finfo, object); magic = finfo-magic; } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rs|lr, zfinfo, buffer, buffer_len, options, zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rS|ir, zfinfo, buffer,
[PHP-CVS] com php-src: Move add/sub to timelib.: ext/date/lib/interval.c ext/date/lib/timelib.h ext/date/php_date.c
Commit:5d0c526199add0e4f054a57db29d882c8ad89a23 Author:Derick Rethans git...@derickrethans.nl Tue, 16 Apr 2013 16:31:10 +0100 Parents: 324e6a5f82d830cf46e0cf35f82c44253b8bd2cf Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5d0c526199add0e4f054a57db29d882c8ad89a23 Log: Move add/sub to timelib. Changed paths: M ext/date/lib/interval.c M ext/date/lib/timelib.h M ext/date/php_date.c Diff: diff --git a/ext/date/lib/interval.c b/ext/date/lib/interval.c index e765a42..7fa1fc5 100644 --- a/ext/date/lib/interval.c +++ b/ext/date/lib/interval.c @@ -87,3 +87,59 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two) return rt; } + +timelib_time *timelib_add(timelib_time *old_time, timelib_rel_time *interval) +{ + int bias = 1; + timelib_time *t = timelib_time_clone(old_time); + + if (interval-have_weekday_relative || interval-have_special_relative) { + memcpy(t-relative, interval, sizeof(struct timelib_rel_time)); + } else { + if (interval-invert) { + bias = -1; + } + memset(t-relative, 0, sizeof(struct timelib_rel_time)); + t-relative.y = interval-y * bias; + t-relative.m = interval-m * bias; + t-relative.d = interval-d * bias; + t-relative.h = interval-h * bias; + t-relative.i = interval-i * bias; + t-relative.s = interval-s * bias; + } + t-have_relative = 1; + t-sse_uptodate = 0; + + timelib_update_ts(t, NULL); + timelib_update_from_sse(t); + t-have_relative = 0; + + return t; +} + +timelib_time *timelib_sub(timelib_time *old_time, timelib_rel_time *interval) +{ + int bias = 1; + timelib_time *t = timelib_time_clone(old_time); + + if (interval-invert) { + bias = -1; + } + + memset(t-relative, 0, sizeof(struct timelib_rel_time)); + t-relative.y = 0 - (interval-y * bias); + t-relative.m = 0 - (interval-m * bias); + t-relative.d = 0 - (interval-d * bias); + t-relative.h = 0 - (interval-h * bias); + t-relative.i = 0 - (interval-i * bias); + t-relative.s = 0 - (interval-s * bias); + t-have_relative = 1; + t-sse_uptodate = 0; + + timelib_update_ts(t, NULL); + timelib_update_from_sse(t); + + t-have_relative = 0; + + return t; +} diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h index 478dec3..2acb765 100644 --- a/ext/date/lib/timelib.h +++ b/ext/date/lib/timelib.h @@ -136,5 +136,7 @@ int timelib_astro_rise_set_altitude(timelib_time *time, double lon, double lat, /* from interval.c */ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two); +timelib_time *timelib_add(timelib_time *t, timelib_rel_time *interval); +timelib_time *timelib_sub(timelib_time *t, timelib_rel_time *interval); #endif diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 05ac672..2bb555a 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2889,7 +2889,7 @@ PHP_FUNCTION(date_add) zval *object, *interval; php_date_obj *dateobj; php_interval_obj *intobj; - int bias = 1; + timelib_time *new_time; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), OO, object, date_ce_date, interval, date_ce_interval) == FAILURE) { RETURN_FALSE; @@ -2899,27 +2899,9 @@ PHP_FUNCTION(date_add) intobj = (php_interval_obj *) zend_object_store_get_object(interval TSRMLS_CC); DATE_CHECK_INITIALIZED(intobj-initialized, DateInterval); - - if (intobj-diff-have_weekday_relative || intobj-diff-have_special_relative) { - memcpy(dateobj-time-relative, intobj-diff, sizeof(struct timelib_rel_time)); - } else { - if (intobj-diff-invert) { - bias = -1; - } - memset(dateobj-time-relative, 0, sizeof(struct timelib_rel_time)); - dateobj-time-relative.y = intobj-diff-y * bias; - dateobj-time-relative.m = intobj-diff-m * bias; - dateobj-time-relative.d = intobj-diff-d * bias; - dateobj-time-relative.h = intobj-diff-h * bias; - dateobj-time-relative.i = intobj-diff-i * bias; - dateobj-time-relative.s = intobj-diff-s * bias; - } - dateobj-time-have_relative = 1; - dateobj-time-sse_uptodate = 0; - - timelib_update_ts(dateobj-time, NULL); - timelib_update_from_sse(dateobj-time); - dateobj-time-have_relative = 0; + new_time = timelib_add(dateobj-time, intobj-diff); + timelib_time_dtor(dateobj-time); + dateobj-time = new_time; RETURN_ZVAL(object, 1, 0); } @@ -2933,7 +2915,7 @@ PHP_FUNCTION(date_sub) zval *object, *interval;
[PHP-CVS] com php-src: Remove duplicate / commented code in GMP: ext/gmp/gmp.c
Commit:8860758a74ce5b2237e3b00131cbb63abd4613bb Author:Nikita Popov ni...@php.net Sat, 23 Nov 2013 12:54:20 +0100 Parents: 36bd7296c85ac498ec1c38e85e1ded46d98982a8 Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8860758a74ce5b2237e3b00131cbb63abd4613bb Log: Remove duplicate / commented code in GMP Changed paths: M ext/gmp/gmp.c Diff: diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index af9c73a..9a49bec 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -1665,6 +1665,7 @@ ZEND_FUNCTION(gmp_cmp) Gets the sign of the number */ ZEND_FUNCTION(gmp_sign) { + /* Can't use gmp_unary_opl here, because mpz_sgn is a macro */ zval *a_arg; mpz_ptr gmpnum_a; gmp_temp_t temp_a; @@ -1672,7 +1673,7 @@ ZEND_FUNCTION(gmp_sign) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, a_arg) == FAILURE){ return; } - + FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); RETVAL_LONG(mpz_sgn(gmpnum_a)); @@ -1747,32 +1748,6 @@ ZEND_FUNCTION(gmp_nextprime) ZEND_FUNCTION(gmp_xor) { gmp_binary_op(mpz_xor); - /* use formula: a^b = (a|b)~(ab) */ - /*zval **a_arg, **b_arg; - mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result, *gmpnum_t; - gmp_temp_t temp_a, temp_b; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ZZ, a_arg, b_arg) == FAILURE){ - return; - } - - FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a); - - INIT_GMP_NUM(gmpnum_result); - INIT_GMP_NUM(gmpnum_t); - - mpz_and(*gmpnum_t, *gmpnum_a, *gmpnum_b); - mpz_com(*gmpnum_t, *gmpnum_t); - - mpz_ior(*gmpnum_result, *gmpnum_a, *gmpnum_b); - mpz_and(*gmpnum_result, *gmpnum_result, *gmpnum_t); - - FREE_GMP_NUM(gmpnum_t); - - FREE_GMP_TEMP(temp_a); - FREE_GMP_TEMP(temp_b); - RETVAL_GMP(gmpnum_result);*/ } /* }}} */ @@ -1852,18 +1827,7 @@ ZEND_FUNCTION(gmp_testbit) Calculates the population count of a */ ZEND_FUNCTION(gmp_popcount) { - zval *a_arg; - mpz_ptr gmpnum_a; - gmp_temp_t temp_a; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, a_arg) == FAILURE){ - return; - } - - FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - - RETVAL_LONG(mpz_popcount(gmpnum_a)); - FREE_GMP_TEMP(temp_a); + gmp_unary_opl((gmp_unary_opl_t) mpz_popcount); } /* }}} */ @@ -1871,20 +1835,7 @@ ZEND_FUNCTION(gmp_popcount) Calculates hamming distance between a and b */ ZEND_FUNCTION(gmp_hamdist) { - zval *a_arg, *b_arg; - mpz_ptr gmpnum_a, gmpnum_b; - gmp_temp_t temp_a, temp_b; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zz, a_arg, b_arg) == FAILURE){ - return; - } - - FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a); - - RETVAL_LONG(mpz_hamdist(gmpnum_a, gmpnum_b)); - FREE_GMP_TEMP(temp_a); - FREE_GMP_TEMP(temp_b); + gmp_binary_opl((gmp_binary_opl_t) mpz_hamdist); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Merge branch 'const_scalar_exprs' into PHP-5.6: Zend/zend.h Zend/zend_API.c Zend/zend_compile.c Zend/zend_compile.h Zend/zend_operators.h Zend/zend_vm_def.h Zend/zend_vm_execute
Commit:d36cf9029110268e8ae7f700f620823dcaab5d8e Author:Bob Weinand bobw...@hotmail.com Thu, 28 Nov 2013 13:41:42 +0100 Parents: 9d060e8d48bd6b2cc8c2a30f3b0eeeb4d867d934 152898ff2872f2bdf2123a52c37f6e64c18ab88a Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d36cf9029110268e8ae7f700f620823dcaab5d8e Log: Merge branch 'const_scalar_exprs' into PHP-5.6 Conflicts: Zend/zend_extensions.h Changed paths: MM Zend/zend.h MM Zend/zend_API.c MM Zend/zend_compile.c MM Zend/zend_compile.h MM Zend/zend_operators.h MM Zend/zend_vm_def.h MM Zend/zend_vm_execute.h MM ext/opcache/zend_accelerator_util_funcs.c Diff: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Removed duplicated hash function implementation (100% source compatible): Zend/zend_hash.c Zend/zend_hash.h
Commit:aa427a10d4064e0873b3de8cf1b38f2dabc02913 Author:Dmitry Stogov dmi...@zend.com Thu, 28 Nov 2013 17:01:10 +0400 Parents: 9d060e8d48bd6b2cc8c2a30f3b0eeeb4d867d934 Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=aa427a10d4064e0873b3de8cf1b38f2dabc02913 Log: Removed duplicated hash function implementation (100% source compatible) Changed paths: M Zend/zend_hash.c M Zend/zend_hash.h Diff: diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index ae7d840..5d81c28 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -876,12 +876,6 @@ ZEND_API void zend_hash_merge_ex(HashTable *target, HashTable *source, copy_ctor } -ZEND_API ulong zend_get_hash_value(const char *arKey, uint nKeyLength) -{ - return zend_inline_hash_func(arKey, nKeyLength); -} - - /* Returns SUCCESS if found and FAILURE if not. The pointer to the * data is returned in pData. The reason is that there's no reason * someone using the hash table might not want to have NULL data diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 69732cd..74bede1 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -157,8 +157,8 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, const char *arKey, uint n zend_hash_del_key_or_index(ht, arKey, nKeyLength, h, HASH_DEL_KEY_QUICK) #define zend_hash_index_del(ht, h) \ zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX) - -ZEND_API ulong zend_get_hash_value(const char *arKey, uint nKeyLength); +#define zend_get_hash_value \ + zend_hash_func /* Data retreival */ ZEND_API int zend_hash_find(const HashTable *ht, const char *arKey, uint nKeyLength, void **pData); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: fixed ext/curl: ext/curl/curl_file.c ext/curl/interface.c ext/curl/multi.c ext/curl/php_curl.h ext/curl/share.c
Commit:1e2cc1584594fd75ba742a7dd1b82a333e713890 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 13:45:09 +0100 Parents: 46448539b0482875473d66c20a8e319578e41a4d Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1e2cc1584594fd75ba742a7dd1b82a333e713890 Log: fixed ext/curl Changed paths: M ext/curl/curl_file.c M ext/curl/interface.c M ext/curl/multi.c M ext/curl/php_curl.h M ext/curl/share.c diff --git a/ext/curl/curl_file.c b/ext/curl/curl_file.c index 91dfd27..ef626da 100644 --- a/ext/curl/curl_file.c +++ b/ext/curl/curl_file.c @@ -32,10 +32,10 @@ PHP_CURL_API zend_class_entry *curl_CURLFile_class; static void curlfile_ctor(INTERNAL_FUNCTION_PARAMETERS) { char *fname = NULL, *mime = NULL, *postname = NULL; - int fname_len, mime_len, postname_len; + zend_str_size_int fname_len, mime_len, postname_len; zval *cf = return_value; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|ss, fname, fname_len, mime, mime_len, postname, postname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S|SS, fname, fname_len, mime, mime_len, postname, postname_len) == FAILURE) { return; } @@ -85,9 +85,9 @@ static void curlfile_get_property(char *name, INTERNAL_FUNCTION_PARAMETERS) static void curlfile_set_property(char *name, INTERNAL_FUNCTION_PARAMETERS) { char *arg = NULL; - int arg_len; + zend_str_size_int arg_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, arg, arg_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, S, arg, arg_len) == FAILURE) { return; } zend_update_property_string(curl_CURLFile_class, getThis(), name, strlen(name), arg TSRMLS_CC); diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 5913159..08da632 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -154,7 +154,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC); #define SAVE_CURL_ERROR(__handle, __err) (__handle)-err.no = (int) __err; -#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s), (long) v); +#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s), (php_int_t) v); #define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s), (double) v); #define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) (v ? v : ), 1); #define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v); @@ -165,7 +165,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC); # define php_curl_ret(__ret) RETVAL_FALSE; return; #endif -static int php_curl_option_url(php_curl *ch, const char *url, const int len TSRMLS_DC) /* {{{ */ +static int php_curl_option_url(php_curl *ch, const char *url, const zend_str_size_int len TSRMLS_DC) /* {{{ */ { CURLcode error = CURLE_OK; #if LIBCURL_VERSION_NUM 0x071100 @@ -1283,7 +1283,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx) return fwrite(data, size, nmemb, t-fp); case PHP_CURL_RETURN: if (length 0) { - smart_str_appendl(t-buf, data, (int) length); + smart_str_appendl(t-buf, data, (php_int_t) length); } break; case PHP_CURL_USER: { @@ -1340,11 +1340,11 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx) #if LIBCURL_VERSION_NUM = 0x071500 /* Available since 7.21.0 */ /* {{{ curl_fnmatch */ -static int curl_fnmatch(void *ctx, const char *pattern, const char *string) +static php_int_t curl_fnmatch(void *ctx, const char *pattern, const char *string) { php_curl *ch = (php_curl *) ctx; php_curl_fnmatch *t = ch-handlers-fnmatch; - int rval = CURL_FNMATCHFUNC_FAIL; + php_int_t rval = CURL_FNMATCHFUNC_FAIL; switch (t-method) { case PHP_CURL_USER: { zval **argv[3]; @@ -1436,10 +1436,10 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double ZVAL_RESOURCE(handle, ch-id); zend_list_addref(ch-id); - ZVAL_LONG(zdltotal, (long) dltotal); - ZVAL_LONG(zdlnow, (long) dlnow); - ZVAL_LONG(zultotal, (long) ultotal); - ZVAL_LONG(zulnow, (long) ulnow); + ZVAL_LONG(zdltotal, (php_int_t) dltotal); + ZVAL_LONG(zdlnow, (php_int_t) dlnow); + ZVAL_LONG(zultotal, (php_int_t) ultotal); + ZVAL_LONG(zulnow, (php_int_t) ulnow); argv[0] = handle; argv[1] = zdltotal; @@ -1489,7 +1489,7 @@ static size_t curl_read(char
[PHP-CVS] com php-src: Removed unused pHashFunction argument in _zend_hash_init() and family (must be 99% source compatible): Zend/zend_API.c Zend/zend_hash.c Zend/zend_hash.h Zend/zend_ts_hash.c Ze
Commit:5d2576264653c2faaca9cd7d64218d10ab612408 Author:Dmitry Stogov dmi...@zend.com Thu, 28 Nov 2013 18:40:46 +0400 Parents: 5d6b20f66b2dd3800694c9562c4aafa013af1652 Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5d2576264653c2faaca9cd7d64218d10ab612408 Log: Removed unused pHashFunction argument in _zend_hash_init() and family (must be 99% source compatible) Changed paths: M Zend/zend_API.c M Zend/zend_hash.c M Zend/zend_hash.h M Zend/zend_ts_hash.c M Zend/zend_ts_hash.h Diff: diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 927d08c..18f151e 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1010,7 +1010,7 @@ ZEND_API int _array_init(zval *arg, uint size ZEND_FILE_LINE_DC) /* {{{ */ { ALLOC_HASHTABLE_REL(Z_ARRVAL_P(arg)); - _zend_hash_init(Z_ARRVAL_P(arg), size, NULL, ZVAL_PTR_DTOR, 0 ZEND_FILE_LINE_RELAY_CC); + _zend_hash_init(Z_ARRVAL_P(arg), size, ZVAL_PTR_DTOR, 0 ZEND_FILE_LINE_RELAY_CC); Z_TYPE_P(arg) = IS_ARRAY; return SUCCESS; } diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 00ee6b8..b8aa679 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -141,7 +141,7 @@ ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength) static const Bucket *uninitialized_bucket = NULL; -ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) { uint i = 3; @@ -172,9 +172,9 @@ ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunctio } -ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC) +ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC) { - int retval = _zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent ZEND_FILE_LINE_CC); + int retval = _zend_hash_init(ht, nSize, pDestructor, persistent ZEND_FILE_LINE_CC); ht-bApplyProtection = bApplyProtection; return retval; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 74bede1..c97412b 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -97,12 +97,12 @@ typedef Bucket* HashPosition; BEGIN_EXTERN_C() /* startup/shutdown */ -ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC); -ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC); +ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC); +ZEND_API int _zend_hash_init_ex(HashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC); ZEND_API void zend_hash_destroy(HashTable *ht); ZEND_API void zend_hash_clean(HashTable *ht); -#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) _zend_hash_init((ht), (nSize), (pHashFunction), (pDestructor), (persistent) ZEND_FILE_LINE_CC) -#define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pHashFunction), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC) +#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent) _zend_hash_init((ht), (nSize), (pDestructor), (persistent) ZEND_FILE_LINE_CC) +#define zend_hash_init_ex(ht, nSize, pHashFunction, pDestructor, persistent, bApplyProtection) _zend_hash_init_ex((ht), (nSize), (pDestructor), (persistent), (bApplyProtection) ZEND_FILE_LINE_CC) /* additions/updates/changes */ ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c index f517fe8..337e289 100644 --- a/Zend/zend_ts_hash.c +++ b/Zend/zend_ts_hash.c @@ -59,24 +59,24 @@ static void end_write(TsHashTable *ht) } /* delegates */ -ZEND_API int _zend_ts_hash_init(TsHashTable *ht, uint nSize, hash_func_t pHashFunction, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) +ZEND_API int _zend_ts_hash_init(TsHashTable *ht, uint nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC) { #ifdef ZTS ht-mx_reader = tsrm_mutex_alloc(); ht-mx_writer = tsrm_mutex_alloc(); ht-reader = 0; #endif - return
[PHP-CVS] com php-src: converted several switches to ifs and made more opcache friendly: Zend/zend.h Zend/zend_API.c Zend/zend_ast.c Zend/zend_builtin_functions.c Zend/zend_compile.c Zend/zend_execute
Commit:b45043a1b71c29a0c7b8de9e4929dde08bd61216 Author:Bob Weinand bobw...@hotmail.com Fri, 1 Nov 2013 16:16:58 +0100 Parents: b56c1ca95e16ea1c2a3ce251b91297d0a81a9070 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b45043a1b71c29a0c7b8de9e4929dde08bd61216 Log: converted several switches to ifs and made more opcache friendly Changed paths: M Zend/zend.h M Zend/zend_API.c M Zend/zend_ast.c M Zend/zend_builtin_functions.c M Zend/zend_compile.c M Zend/zend_execute_API.c M Zend/zend_vm_def.h M Zend/zend_vm_execute.h M ext/reflection/php_reflection.c diff --git a/Zend/zend.h b/Zend/zend.h index 7ccd081..8154277 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -600,6 +600,8 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length); #define IS_LEXICAL_REF 0x040 #define IS_CONSTANT_IN_NAMESPACE 0x100 +#define IS_CONSTANT_TYPE(type) (((type) IS_CONSTANT_TYPE_MASK) = IS_CONSTANT ((type) IS_CONSTANT_TYPE_MASK) = IS_CONSTANT_AST) + /* overloaded elements data types */ #define OE_IS_ARRAY(10) #define OE_IS_OBJECT (11) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 3051d19..b414b52 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1053,37 +1053,33 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro static int zval_update_class_constant(zval **pp, int is_static, int offset TSRMLS_DC) /* {{{ */ { - switch (Z_TYPE_PP(pp) IS_CONSTANT_TYPE_MASK) { - case IS_CONSTANT: - case IS_CONSTANT_ARRAY: - case IS_CONSTANT_AST: { - zend_class_entry **scope = EG(in_execution)?EG(scope):CG(active_class_entry); - - if ((*scope)-parent) { - zend_class_entry *ce = *scope; - HashPosition pos; - zend_property_info *prop_info; - - do { - for (zend_hash_internal_pointer_reset_ex(ce-properties_info, pos); - zend_hash_get_current_data_ex(ce-properties_info, (void **) prop_info, pos) == SUCCESS; - zend_hash_move_forward_ex(ce-properties_info, pos)) { - if (is_static == ((prop_info-flags ZEND_ACC_STATIC) != 0) - offset == prop_info-offset) { - int ret; - zend_class_entry *old_scope = *scope; - *scope = prop_info-ce; - ret = zval_update_constant(pp, (void*)1 TSRMLS_CC); - *scope = old_scope; - return ret; - } - } - ce = ce-parent; - } while (ce); - + if (IS_CONSTANT_TYPE(Z_TYPE_PP(pp))) { + zend_class_entry **scope = EG(in_execution)?EG(scope):CG(active_class_entry); + + if ((*scope)-parent) { + zend_class_entry *ce = *scope; + HashPosition pos; + zend_property_info *prop_info; + + do { + for (zend_hash_internal_pointer_reset_ex(ce-properties_info, pos); + zend_hash_get_current_data_ex(ce-properties_info, (void **) prop_info, pos) == SUCCESS; + zend_hash_move_forward_ex(ce-properties_info, pos)) { + if (is_static == ((prop_info-flags ZEND_ACC_STATIC) != 0) + offset == prop_info-offset) { + int ret; + zend_class_entry *old_scope = *scope; + *scope = prop_info-ce; + ret = zval_update_constant(pp, (void*)1 TSRMLS_CC); + *scope = old_scope; + return ret; + } + } + ce = ce-parent; + } while (ce); + } - return zval_update_constant(pp, (void*)1 TSRMLS_CC); - } + return zval_update_constant(pp, (void*)1
[PHP-CVS] com php-src: fix after automerge: Zend/zend_language_parser.y
Commit:91e6fb75d5adfae3c6fc6fc122f631b6eabeb493 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 17:44:05 +0100 Parents: 5ced3db9714c02d2fd40370f632f23d047f51987 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=91e6fb75d5adfae3c6fc6fc122f631b6eabeb493 Log: fix after automerge Changed paths: M Zend/zend_language_parser.y Diff: diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index cf9ec67..f73c6aa 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -962,7 +962,7 @@ static_scalar_value: | static_class_name_scalar{ $$.u.ast = zend_ast_create_constant($1.u.constant); } | namespace_name { zend_do_fetch_constant($$, NULL, $1, ZEND_CT, 1 TSRMLS_CC); $$.u.ast = zend_ast_create_constant($$.u.constant); } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$.op_type = IS_CONST; ZVAL_EMPTY_STRING($$.u.constant); zend_do_build_namespace_name($$, $$, $3 TSRMLS_CC); $3 = $$; zend_do_fetch_constant($$, NULL, $3, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant($$.u.constant); } - | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); memcpy((tmp[1]), Z_STRVAL($2.u.constant), Z_STRLEN($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRLEN($2.u.constant); zend_do_fetch_constant($$, NULL, $2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant($$.u.constant); } + | T_NS_SEPARATOR namespace_name { char *tmp = estrndup(Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); memcpy((tmp[1]), Z_STRVAL($2.u.constant), Z_STRSIZE($2.u.constant)+1); tmp[0] = '\\'; efree(Z_STRVAL($2.u.constant)); Z_STRVAL($2.u.constant) = tmp; ++Z_STRSIZE($2.u.constant); zend_do_fetch_constant($$, NULL, $2, ZEND_CT, 0 TSRMLS_CC); $$.u.ast = zend_ast_create_constant($$.u.constant); } | static_class_constant { $$.u.ast = zend_ast_create_constant($1.u.constant); } | T_CLASS_C { $$.u.ast = zend_ast_create_constant($1.u.constant); } | static_operation { $$ = $1; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Whitespace fix: Zend/zend_API.c
Commit:82cd3779f4644a903b6dbbc966e72ebc54c9d694 Author:Bob Weinand bobw...@hotmail.com Fri, 1 Nov 2013 16:49:23 +0100 Parents: b45043a1b71c29a0c7b8de9e4929dde08bd61216 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=82cd3779f4644a903b6dbbc966e72ebc54c9d694 Log: Whitespace fix Changed paths: M Zend/zend_API.c Diff: diff --git a/Zend/zend_API.c b/Zend/zend_API.c index b414b52..3687b6a 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1066,7 +1066,7 @@ static int zval_update_class_constant(zval **pp, int is_static, int offset TSRML zend_hash_get_current_data_ex(ce-properties_info, (void **) prop_info, pos) == SUCCESS; zend_hash_move_forward_ex(ce-properties_info, pos)) { if (is_static == ((prop_info-flags ZEND_ACC_STATIC) != 0) - offset == prop_info-offset) { + offset == prop_info-offset) { int ret; zend_class_entry *old_scope = *scope; *scope = prop_info-ce; @@ -1078,7 +1078,7 @@ static int zval_update_class_constant(zval **pp, int is_static, int offset TSRML ce = ce-parent; } while (ce); - } + } return zval_update_constant(pp, (void*)1 TSRMLS_CC); } return 0; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Fixed mem leaks, added tests and ternary operator: Zend/tests/class_properties_dynamic.phpt Zend/tests/class_properties_static.phpt Zend/tests/constant_expressions.phpt Zend/tes
Commit:466c5dd1fe194ab3d1634695e2dc96240f951f50 Author:Bob Weinand bobw...@hotmail.com Thu, 31 Oct 2013 18:21:37 +0100 Parents: 2361745806553db9099542d9237ade00dcee799b Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=466c5dd1fe194ab3d1634695e2dc96240f951f50 Log: Fixed mem leaks, added tests and ternary operator Changed paths: A Zend/tests/class_properties_dynamic.phpt A Zend/tests/class_properties_static.phpt A Zend/tests/constant_expressions.phpt A Zend/tests/constant_expressions_dynamic.phpt A Zend/tests/function_arguments_003.phpt A Zend/tests/static_variable.phpt M Zend/zend_ast.c M Zend/zend_ast.h M Zend/zend_execute_API.c M Zend/zend_language_parser.y M Zend/zend_operators.c M Zend/zend_operators.h diff --git a/Zend/tests/class_properties_dynamic.phpt b/Zend/tests/class_properties_dynamic.phpt new file mode 100644 index 000..8a1fc6f --- /dev/null +++ b/Zend/tests/class_properties_dynamic.phpt @@ -0,0 +1,13 @@ +--TEST-- +Class Property Expressions +--FILE-- +?php +class Foo { + const BAR = 1 0; + const BAZ = 1 1; + public $bar = self::BAR | self::BAZ; +} +echo (new Foo)-bar; +? +--EXPECTF-- +3 diff --git a/Zend/tests/class_properties_static.phpt b/Zend/tests/class_properties_static.phpt new file mode 100644 index 000..9a56466 --- /dev/null +++ b/Zend/tests/class_properties_static.phpt @@ -0,0 +1,20 @@ +--TEST-- +Static Class Property Expressions +--FILE-- +?php +class Foo { + public $b1 = 1 + 1; + public $b2 = 1 2; + public $b3 = foo . bar . baz; +} +$f = new Foo; +var_dump( + $f-b1, + $f-b2, + $f-b3 +); +? +--EXPECT-- +int(2) +int(4) +string(13) foo bar baz diff --git a/Zend/tests/constant_expressions.phpt b/Zend/tests/constant_expressions.phpt new file mode 100644 index 000..441b9a6 --- /dev/null +++ b/Zend/tests/constant_expressions.phpt @@ -0,0 +1,49 @@ +--TEST-- +Constant Expressions +--FILE-- +?php +const T_1 = 1 1; +const T_2 = 1 / 2; +const T_3 = 1.5 + 1.5; +const T_4 = foo . bar; +const T_5 = (1.5 + 1.5) * 2; +const T_6 = foo . 2 . 3 . 4.0; +const T_7 = __LINE__; +const T_8 = ENDOFSTRING +This is a test string +ENDOFSTRING; +const T_9 = ~-1; +const T_10 = (-1?:1) + (0?2:3); + +// Test order of operations +const T_11 = 1 + 2 * 3; + +// Test for memory leaks +const T_12 = 1 + 2 + 3; + +var_dump(T_1); +var_dump(T_2); +var_dump(T_3); +var_dump(T_4); +var_dump(T_5); +var_dump(T_6); +var_dump(T_7); +var_dump(T_8); +var_dump(T_9); +var_dump(T_10); +var_dump(T_11); +var_dump(T_12); +? +--EXPECT-- +int(2) +float(0.5) +float(3) +string(6) foobar +float(6) +string(6) foo234 +int(8) +string(21) This is a test string +int(0) +int(2) +int(7) +int(6) diff --git a/Zend/tests/constant_expressions_dynamic.phpt b/Zend/tests/constant_expressions_dynamic.phpt new file mode 100644 index 000..21c9216 --- /dev/null +++ b/Zend/tests/constant_expressions_dynamic.phpt @@ -0,0 +1,11 @@ +--TEST-- +Dynamic Constant Expressions +--FILE-- +?php +const FOO = 1; +const BAR = FOO | 2; + +echo BAR; +? +--EXPECTF-- +3 diff --git a/Zend/tests/function_arguments_003.phpt b/Zend/tests/function_arguments_003.phpt new file mode 100644 index 000..b882476 --- /dev/null +++ b/Zend/tests/function_arguments_003.phpt @@ -0,0 +1,17 @@ +--TEST-- +Function Argument Parsing #003 +--FILE-- +?php +const a = 10; + +function t1($a = 1 + 1, $b = 1 2, $c = foo . bar, $d = a * 10) { + var_dump($a, $b, $c, $d); +} + +t1(); +? +--EXPECT-- +int(2) +int(4) +string(6) foobar +int(100) diff --git a/Zend/tests/static_variable.phpt b/Zend/tests/static_variable.phpt new file mode 100644 index 000..ea69a8f --- /dev/null +++ b/Zend/tests/static_variable.phpt @@ -0,0 +1,29 @@ +--TEST-- +Static Variable Expressions +--FILE-- +?php +const bar = 2, baz = bar + 1; + +function foo() { + static $a = 1 + 1; + static $b = [bar = 1 + 1, baz * 2 = 1 2]; + static $c = [1 = bar] + [3 = baz]; + var_dump($a, $b, $c); +} + +foo(); +? +--EXPECT-- +int(2) +array(2) { + [2]= + int(2) + [6]= + int(4) +} +array(2) { + [1]= + int(2) + [3]= + int(3) +} diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 705c4df..7d85e24 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -22,7 +22,8 @@ #include zend_execute.h #define OP_IS_CONST_THEN(op, do_code) \ - switch (Z_TYPE_P(op) IS_CONSTANT_TYPE_MASK) { \ + switch (op?Z_TYPE_P(op) IS_CONSTANT_TYPE_MASK:-1) { \ + case -1: \ case IS_CONSTANT: \ case IS_CONSTANT_ARRAY: \ case IS_CONSTANT_AST: { \ @@ -31,20 +32,26 @@ } #define OP_IS_NOT_CONST_THEN(op, do_code) \ - switch (Z_TYPE_P(op) IS_CONSTANT_TYPE_MASK) { \ - case IS_CONSTANT: \ - case IS_CONSTANT_ARRAY: \ - case IS_CONSTANT_AST: \ - break; \ + if (op) { \ + switch (Z_TYPE_P(op)
[PHP-CVS] com php-src: Clean up GMP arginfos: ext/gmp/gmp.c
Commit:f54f308f71edb6c0db679e1d6755af5e9cac2d56 Author:Nikita Popov ni...@php.net Fri, 29 Nov 2013 00:00:41 +0100 Parents: 6d38090c8d1a47844c854a73b57518fb2a7c10a8 Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f54f308f71edb6c0db679e1d6755af5e9cac2d56 Log: Clean up GMP arginfos Removed duplicate arginfos, specified number of required args everywhere and removed weird pass-by-ref arguments. Changed paths: M ext/gmp/gmp.c diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index e64acf9..f243b31 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -43,7 +43,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_init, 0, 0, 1) ZEND_ARG_INFO(0, base) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_gmp_intval, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_intval, 0, 0, 1) ZEND_ARG_INFO(0, gmpnumber) ZEND_END_ARG_INFO() @@ -52,195 +52,62 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_strval, 0, 0, 1) ZEND_ARG_INFO(0, base) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_gmp_add, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_unary, 0, 0, 1) ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_sub, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_mul, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_div_qr, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_binary, 0, 0, 2) ZEND_ARG_INFO(0, a) ZEND_ARG_INFO(0, b) - ZEND_ARG_INFO(0, round) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_div_r, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_div, 0, 0, 2) ZEND_ARG_INFO(0, a) ZEND_ARG_INFO(0, b) ZEND_ARG_INFO(0, round) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_div_q, 0, 0, 2) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) - ZEND_ARG_INFO(0, round) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_mod, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_divexact, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_neg, 0) - ZEND_ARG_INFO(0, a) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_abs, 0) - ZEND_ARG_INFO(0, a) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_fact, 0) - ZEND_ARG_INFO(0, a) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_pow, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_pow, 0, 0, 2) ZEND_ARG_INFO(0, base) ZEND_ARG_INFO(0, exp) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_gmp_powm, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_powm, 0, 0, 3) ZEND_ARG_INFO(0, base) ZEND_ARG_INFO(0, exp) ZEND_ARG_INFO(0, mod) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_gmp_sqrt, 0) - ZEND_ARG_INFO(0, a) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_sqrtrem, 0) - ZEND_ARG_INFO(0, a) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_root, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, nth) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_rootrem, 0) +ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_root, 0, 0, 2) ZEND_ARG_INFO(0, a) ZEND_ARG_INFO(0, nth) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_gmp_perfect_square, 0) - ZEND_ARG_INFO(0, a) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_prob_prime, 0, 0, 1) ZEND_ARG_INFO(0, a) ZEND_ARG_INFO(0, reps) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_gmp_gcd, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_gcdext, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_invert, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_jacobi, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_legendre, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_cmp, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_sign, 0) - ZEND_ARG_INFO(0, a) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random, 0, 0, 0) ZEND_ARG_INFO(0, limiter) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_gmp_and, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_or, 0) - ZEND_ARG_INFO(0, a) - ZEND_ARG_INFO(0, b) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_com, 0) - ZEND_ARG_INFO(0, a) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_gmp_xor, 0) - ZEND_ARG_INFO(0, a) -
[PHP-CVS] com php-src: Marking those two as XFAIL for now.: ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt
Commit:aab0b2ce3b8641848e7e92b9e5c4db044004133d Author:Derick Rethans git...@derickrethans.nl Thu, 28 Nov 2013 14:24:39 + Parents: 582f6e529e843b412d582023bf0270e47b1aa468 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=aab0b2ce3b8641848e7e92b9e5c4db044004133d Log: Marking those two as XFAIL for now. Changed paths: M ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt M ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt Diff: diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt index 62dab5d..fe2e79b 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt @@ -2,6 +2,8 @@ RFC: DateTime and Daylight Saving Time Transitions (zone type 3, bd2) --CREDITS-- Daniel Convissor dani...@php.net +--XFAIL-- +Still not quite right --FILE-- ?php diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt index f8066ae..72351d3 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt @@ -2,6 +2,8 @@ RFC: DateTime and Daylight Saving Time Transitions (zone type 3, fs) --CREDITS-- Daniel Convissor dani...@php.net +--XFAIL-- +Still not quite right --FILE-- ?php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: fixed ext/filter: ext/filter/filter.c ext/filter/logical_filters.c ext/filter/php_filter.h ext/filter/sanitizing_filters.c
Commit:a7862de2db615f351fd746bd2fb87564b9631e73 Author:Anatol Belski a...@php.net Thu, 28 Nov 2013 17:16:25 +0100 Parents: fd7d31973ac0a50c415fae9acf891c52f9e4779f Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a7862de2db615f351fd746bd2fb87564b9631e73 Log: fixed ext/filter Changed paths: M ext/filter/filter.c M ext/filter/logical_filters.c M ext/filter/php_filter.h M ext/filter/sanitizing_filters.c diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 12aebcf..d521486 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -77,7 +77,7 @@ static const filter_list_entry filter_list[] = { #define PARSE_SESSION 6 #endif -static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC); +static unsigned int php_sapi_filter(int arg, char *var, char **val, zend_str_size_uint val_len, zend_str_size_uint *new_val_len TSRMLS_DC); static unsigned int php_sapi_filter_init(TSRMLS_D); /* {{{ arginfo */ @@ -327,7 +327,7 @@ PHP_MINFO_FUNCTION(filter) } /* }}} */ -static filter_list_entry php_find_filter(long id) /* {{{ */ +static filter_list_entry php_find_filter(php_int_t id) /* {{{ */ { int i, size = sizeof(filter_list) / sizeof(filter_list_entry); @@ -358,7 +358,7 @@ static unsigned int php_sapi_filter_init(TSRMLS_D) return SUCCESS; } -static void php_zval_filter(zval **value, long filter, long flags, zval *options, char* charset, zend_bool copy TSRMLS_DC) /* {{{ */ +static void php_zval_filter(zval **value, php_int_t filter, php_int_t flags, zval *options, char* charset, zend_bool copy TSRMLS_DC) /* {{{ */ { filter_list_entry filter_func; @@ -404,7 +404,7 @@ static void php_zval_filter(zval **value, long filter, long flags, zval *options } /* }}} */ -static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC) /* {{{ */ +static unsigned int php_sapi_filter(int arg, char *var, char **val, zend_str_size_uint val_len, zend_str_size_uint *new_val_len TSRMLS_DC) /* {{{ */ { zval new_var, raw_var; zval *array_ptr = NULL, *orig_array_ptr = NULL; @@ -449,7 +449,7 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int if (array_ptr) { /* Store the RAW variable internally */ - Z_STRLEN(raw_var) = val_len; + Z_STRSIZE(raw_var) = val_len; Z_STRVAL(raw_var) = estrndup(*val, val_len); Z_TYPE(raw_var) = IS_STRING; @@ -458,7 +458,7 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int if (val_len) { /* Register mangled variable */ - Z_STRLEN(new_var) = val_len; + Z_STRSIZE(new_var) = val_len; Z_TYPE(new_var) = IS_STRING; if (IF_G(default_filter) != FILTER_UNSAFE_RAW) { @@ -479,11 +479,11 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int if (retval) { if (new_val_len) { - *new_val_len = Z_STRLEN(new_var); + *new_val_len = Z_STRSIZE(new_var); } efree(*val); - if (Z_STRLEN(new_var)) { - *val = estrndup(Z_STRVAL(new_var), Z_STRLEN(new_var)); + if (Z_STRSIZE(new_var)) { + *val = estrndup(Z_STRVAL(new_var), Z_STRSIZE(new_var)); } else { *val = estrdup(); } @@ -494,7 +494,7 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int } /* }}} */ -static void php_zval_filter_recursive(zval **value, long filter, long flags, zval *options, char *charset, zend_bool copy TSRMLS_DC) /* {{{ */ +static void php_zval_filter_recursive(zval **value, php_int_t filter, php_int_t flags, zval *options, char *charset, zend_bool copy TSRMLS_DC) /* {{{ */ { if (Z_TYPE_PP(value) == IS_ARRAY) { zval **element; @@ -523,7 +523,7 @@ static void php_zval_filter_recursive(zval **value, long filter, long flags, zva } /* }}} */ -static zval *php_filter_get_storage(long arg TSRMLS_DC)/* {{{ */ +static zval *php_filter_get_storage(php_int_t arg TSRMLS_DC)/* {{{ */ { zval *array_ptr = NULL; @@ -569,12 +569,12 @@ static zval *php_filter_get_storage(long arg TSRMLS_DC)/* {{{ */ */ PHP_FUNCTION(filter_has_var) { - longarg; + php_int_targ; char *var; - int var_len; + zend_str_size_int var_len; zval *array_ptr = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ls, arg, var, var_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, iS, arg, var, var_len) == FAILURE) {
[PHP-CVS] com php-src: Merge branch 'PHP-5.6': configure.in
Commit:be5b98ef0dded9e87a574bc564169136358a09e1 Author:Bob Weinand bobw...@hotmail.com Thu, 28 Nov 2013 13:53:00 +0100 Parents: 98f3c410d9c93e64c4e109b8f55e6d2f5cdabaac 0652edfed3ac1a17f7677c78c663982b49a5f07b Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be5b98ef0dded9e87a574bc564169136358a09e1 Log: Merge branch 'PHP-5.6' Changed paths: MM configure.in Diff: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Add gmp_root() and gmp_rootrem() functions: NEWS UPGRADING ext/gmp/gmp.c ext/gmp/php_gmp.h
Commit:6d38090c8d1a47844c854a73b57518fb2a7c10a8 Author:Nikita Popov ni...@php.net Thu, 28 Nov 2013 23:42:23 +0100 Parents: 1c8cbe4b4e8e373b37c740b7d96e4beb96414ea0 Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6d38090c8d1a47844c854a73b57518fb2a7c10a8 Log: Add gmp_root() and gmp_rootrem() functions Changed paths: M NEWS M UPGRADING M ext/gmp/gmp.c M ext/gmp/php_gmp.h Diff: diff --git a/NEWS b/NEWS index 29dd740..dabe0cf 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,8 @@ PHP NEWS . Moved GMP to use object as the underlying structure and implemented various improvements based on this. (RFC: https://wiki.php.net/rfc/operator_overloading_gmp). (Nikita) + . Added gmp_root() and gmp_rootrem() functions for calculating nth roots. +(Nikita) - Hash: . Added gost-crypto (CryptoPro S-box) GOST hash algo. (Manuel Mausz) diff --git a/UPGRADING b/UPGRADING index b680a9f..6392c5f 100755 --- a/UPGRADING +++ b/UPGRADING @@ -88,6 +88,9 @@ PHP X.Y UPGRADE NOTES 5. New Functions +- GMP: + Added gmp_root($a, $nth) and gmp_rootrem($a, $nth) for calculating nth roots. + - Openssl: Added string openssl_x509_fingerprint($x509, $type, $binary). diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index d3b6189..e64acf9 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -126,6 +126,16 @@ ZEND_BEGIN_ARG_INFO(arginfo_gmp_sqrtrem, 0) ZEND_ARG_INFO(0, a) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO(arginfo_gmp_root, 0) + ZEND_ARG_INFO(0, a) + ZEND_ARG_INFO(0, nth) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_gmp_rootrem, 0) + ZEND_ARG_INFO(0, a) + ZEND_ARG_INFO(0, nth) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO(arginfo_gmp_perfect_square, 0) ZEND_ARG_INFO(0, a) ZEND_END_ARG_INFO() @@ -256,6 +266,8 @@ const zend_function_entry gmp_functions[] = { ZEND_FE(gmp_fact, arginfo_gmp_fact) ZEND_FE(gmp_sqrt, arginfo_gmp_sqrt) ZEND_FE(gmp_sqrtrem,arginfo_gmp_sqrtrem) + ZEND_FE(gmp_root, arginfo_gmp_root) + ZEND_FE(gmp_rootrem,arginfo_gmp_rootrem) ZEND_FE(gmp_pow,arginfo_gmp_pow) ZEND_FE(gmp_powm, arginfo_gmp_powm) ZEND_FE(gmp_perfect_square, arginfo_gmp_perfect_square) @@ -1514,6 +1526,73 @@ ZEND_FUNCTION(gmp_sqrtrem) } /* }}} */ +/* {{{ proto GMP gmp_root(mixed a, int nth) + Takes integer part of nth root */ +ZEND_FUNCTION(gmp_root) +{ + zval *a_arg; + long nth; + mpz_ptr gmpnum_a, gmpnum_result; + gmp_temp_t temp_a; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zl, a_arg, nth) == FAILURE) { + return; + } + + if (nth = 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, The root must be positive); + RETURN_FALSE; + } + + FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); + + if (nth % 2 == 0 mpz_sgn(gmpnum_a) 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Can't take even root of negative number); + FREE_GMP_TEMP(temp_a); + RETURN_FALSE; + } + + INIT_GMP_RETVAL(gmpnum_result); + mpz_root(gmpnum_result, gmpnum_a, (unsigned long) nth); + FREE_GMP_TEMP(temp_a); +} +/* }}} */ + +/* {{{ proto GMP gmp_rootrem(mixed a, int nth) + Calculates integer part of nth root and remainder */ +ZEND_FUNCTION(gmp_rootrem) +{ + zval *a_arg; + long nth; + mpz_ptr gmpnum_a, gmpnum_result1, gmpnum_result2; + gmp_temp_t temp_a; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zl, a_arg, nth) == FAILURE) { + return; + } + + if (nth = 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, The root must be positive); + RETURN_FALSE; + } + + FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); + + if (nth % 2 == 0 mpz_sgn(gmpnum_a) 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Can't take even root of negative number); + FREE_GMP_TEMP(temp_a); + RETURN_FALSE; + } + + array_init(return_value); + add_index_zval(return_value, 0, gmp_create(gmpnum_result1 TSRMLS_CC)); + add_index_zval(return_value, 1, gmp_create(gmpnum_result2 TSRMLS_CC)); + + mpz_rootrem(gmpnum_result1, gmpnum_result2, gmpnum_a, (unsigned long) nth); + FREE_GMP_TEMP(temp_a); +} +/* }}} */ + /* {{{ proto bool gmp_perfect_square(mixed a) Checks if a is an exact square */ ZEND_FUNCTION(gmp_perfect_square) diff --git a/ext/gmp/php_gmp.h b/ext/gmp/php_gmp.h index e1aaef8..902c3ac 100644 --- a/ext/gmp/php_gmp.h +++ b/ext/gmp/php_gmp.h @@ -45,9 +45,11 @@ ZEND_FUNCTION(gmp_neg); ZEND_FUNCTION(gmp_abs); ZEND_FUNCTION(gmp_fact); ZEND_FUNCTION(gmp_sqrt); +ZEND_FUNCTION(gmp_sqrtrem);
Re: [PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: NEWS Zend/zend_execute_API.c
On Fri, 29 Nov 2013, Dmitry Stogov wrote: Commit:967abd61537a2c7d0beebac9039aa068d518e4eb Author:Dmitry Stogov dmi...@zend.com Fri, 29 Nov 2013 12:54:22 +0400 Parents: b0d24d3d2001ad3bfe6b9a2e66cb631ae49b4064 2d31eadbbf147a157cb4a0c89adaf30fee7371f0 Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=967abd61537a2c7d0beebac9039aa068d518e4eb Log: Merge branch 'PHP-5.4' into PHP-5.5 * PHP-5.4: Added validation of class names in the autoload process Changed paths: MM NEWS THis seems to have changed/messed up the NEWS file? cheers, Derick MM Zend/zend_execute_API.c Diff: diff --cc NEWS index b3c8adf,f55ff05..d16e8bd --- a/NEWS +++ b/NEWS @@@ -1,16 -1,17 +1,19 @@@ PHP NEWS ||| -?? ??? 2013, PHP 5.4.24 +?? ??? 2013, PHP 5.5.8 + - Core: + . Added validation of class names in the autoload process. (Dmitry) + - Date: . Fixed bug #66060 (Heap buffer over-read in DateInterval). (Remi) - . Fixed bug #63391 (Incorrect/inconsistent day of week prior to the year -1600). (Derick, T. Carter) - . Fixed bug #61599 (Wrong Day of Week). (Derick, T. Carter) -?? ??? 2013, PHP 5.4.23 +?? ??? 2013, PHP 5.5.7 + +- CLI server: + . Added some MIME types to the CLI web server (Chris Jones) + . Implemented FR #65917 (getallheaders() is not supported by the built-in web +server) - also implements apache_response_headers() (Andrea Faulds) - Core: . Fixed bug #66094 (unregister_tick_function tries to cast a Closure to a -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://derickrethans.nl | http://xdebug.org Like Xdebug? Consider a donation: http://xdebug.org/donate.php twitter: @derickr and @xdebug Posted with an email client that doesn't mangle email: alpine -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php