Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard assert.c
It will still return and terminate the function, it just will not necessarily terminate the PHP script execution. On 23-Jun-06, at 1:59 PM, Andrey Hristov wrote: Hi Ilia, Ilia Alshanetsky wrote: iliaa Fri Jun 23 11:37:53 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard assert.c Log: Change E_ERROR to E_RECOVERABLE_ERROR http://cvs.php.net/viewvc.cgi/php-src/ext/standard/assert.c? r1=1.60.2.3r2=1.60.2.3.2.1diff_format=u Index: php-src/ext/standard/assert.c diff -u php-src/ext/standard/assert.c:1.60.2.3 php-src/ext/ standard/assert.c:1.60.2.3.2.1 --- php-src/ext/standard/assert.c:1.60.2.3 Sun Jan 1 12:50:14 2006 +++ php-src/ext/standard/assert.c Fri Jun 23 11:37:53 2006 @@ -16,7 +16,7 @@ + --+ */ -/* $Id: assert.c,v 1.60.2.3 2006/01/01 12:50:14 sniper Exp $ */ +/* $Id: assert.c,v 1.60.2.3.2.1 2006/06/23 11:37:53 iliaa Exp $ */ /* {{{ includes/startup/misc */ @@ -151,7 +151,7 @@ compiled_string_description = zend_make_compiled_string_description(assert code TSRMLS_CC); if (zend_eval_string(myeval, retval, compiled_string_description TSRMLS_CC) == FAILURE) { efree(compiled_string_description); - php_error_docref(NULL TSRMLS_CC, E_ERROR, Failure evaluating code: %s%s, PHP_EOL, myeval); + php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, Failure evaluating code: %s%s, PHP_EOL, myeval); /* php_error_docref() does not return in this case. */ See this comment, not sure about E_RECOVERABLE_ERROR, but if does return, then the comment does not hold any more and probably more has to be changed? } efree(compiled_string_description); Regards, Andrey Ilia Alshanetsky -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: CVSROOT / avail
derick Sat Jun 24 14:18:02 2006 UTC Modified files: /CVSROOTavail Log: - Give Tobias access to talks things. http://cvs.php.net/viewvc.cgi/CVSROOT/avail?r1=1.1148r2=1.1149diff_format=u Index: CVSROOT/avail diff -u CVSROOT/avail:1.1148 CVSROOT/avail:1.1149 --- CVSROOT/avail:1.1148Mon Jun 19 20:34:00 2006 +++ CVSROOT/avail Sat Jun 24 14:18:02 2006 @@ -50,7 +50,7 @@ # The PHP Presentation Group has access to the presentations on the # conf.php.net site. -avail|sterling,jon,graeme,derick,imajes,wez,iliaa,jmcastagnetto,shiflett,nohn,sebastian,vmarshall,alan_k,lhl,eru,sklar,wenz,zak,gschlossnagle,jacques,pollita,amt,john,hholzgra,pajoye,helly,dbs,vrana|pres,pres2,presentations +avail|toby,sterling,jon,graeme,derick,imajes,wez,iliaa,jmcastagnetto,shiflett,nohn,sebastian,vmarshall,alan_k,lhl,eru,sklar,wenz,zak,gschlossnagle,jacques,pollita,amt,john,hholzgra,pajoye,helly,dbs,vrana|pres,pres2,presentations # The PHP Quality Assurance Team maintains their own website. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/unicode unicode_iterators.c
andrei Sat Jun 24 18:18:38 2006 UTC Modified files: /php-src/ext/unicodeunicode_iterators.c Log: - Remove support for code units in TextIterator (people shouldn't be examining individual code units anyway) - Add offset() method. - Add optional locale parameter to the constructor. http://cvs.php.net/viewvc.cgi/php-src/ext/unicode/unicode_iterators.c?r1=1.24r2=1.25diff_format=u Index: php-src/ext/unicode/unicode_iterators.c diff -u php-src/ext/unicode/unicode_iterators.c:1.24 php-src/ext/unicode/unicode_iterators.c:1.25 --- php-src/ext/unicode/unicode_iterators.c:1.24Fri Mar 24 21:06:36 2006 +++ php-src/ext/unicode/unicode_iterators.c Sat Jun 24 18:18:38 2006 @@ -14,14 +14,13 @@ +--+ */ -/* $Id: unicode_iterators.c,v 1.24 2006/03/24 21:06:36 andrei Exp $ */ +/* $Id: unicode_iterators.c,v 1.25 2006/06/24 18:18:38 andrei Exp $ */ /* * TODO * * - optimize current() to pass return_value to the handler so that it fills it * in directly instead of creating a new zval - * - return code units as binary strings? integers? or leave as unicode strings? * - implement Countable (or count_elements handler) and Seekable interfaces */ @@ -31,7 +30,6 @@ #include unicode/ubrk.h typedef enum { - ITER_CODE_UNIT, ITER_CODE_POINT, ITER_COMB_SEQUENCE, ITER_CHARACTER, @@ -53,23 +51,21 @@ size_t current_alloc; longflags; union { + int32_t start; struct { + int32_t start; int32_t index; - int32_t offset; } cp; struct { - int32_t index; - } cu; - struct { - int32_t index; int32_t start; int32_t end; + int32_t index; } cs; struct { - UBreakIterator *iter; - int32_t index; int32_t start; int32_t end; + int32_t index; + UBreakIterator *iter; } brk; } u; zend_object_iterator iter; @@ -99,71 +95,14 @@ PHPAPI zend_class_entry* text_iterator_ce; PHPAPI zend_class_entry* rev_text_iterator_ce; -/* Code unit ops */ - -static int text_iter_cu_valid(text_iter_obj* object TSRMLS_DC) -{ - if (object-flags ITER_REVERSE) { - return (object-u.cu.index = 0); - } else { - return (object-u.cu.index object-text_len); - } -} - -static void text_iter_cu_current(text_iter_obj* object TSRMLS_DC) -{ - u_memcpy(Z_USTRVAL_P(object-current), object-text + object-u.cu.index, 1); - Z_USTRVAL_P(object-current)[1] = 0; - Z_USTRLEN_P(object-current) = 1; -} - -static int text_iter_cu_key(text_iter_obj* object TSRMLS_DC) -{ - if (object-flags ITER_REVERSE) { - return object-text_len - object-u.cu.index - 1; - } else { - return object-u.cu.index; - } -} - -static void text_iter_cu_next(text_iter_obj* object TSRMLS_DC) -{ - if (object-flags ITER_REVERSE) { - if (object-u.cu.index = 0) { - object-u.cu.index--; - } - } else { - if (object-u.cu.index object-text_len) { - object-u.cu.index++; - } - } -} - -static void text_iter_cu_rewind(text_iter_obj *object TSRMLS_DC) -{ - if (object-flags ITER_REVERSE) { - object-u.cu.index = object-text_len-1; - } else { - object-u.cu.index = 0; - } -} - -static text_iter_ops text_iter_cu_ops = { - text_iter_cu_valid, - text_iter_cu_current, - text_iter_cu_key, - text_iter_cu_next, - text_iter_cu_rewind, -}; - /* Code point ops */ static int text_iter_cp_valid(text_iter_obj* object TSRMLS_DC) { if (object-flags ITER_REVERSE) { - return (object-u.cp.offset 0); + return (object-u.cp.start 0); } else { - return (object-u.cp.offset object-text_len); + return (object-u.cp.start object-text_len); } } @@ -172,7 +111,7 @@ UChar32 cp; int32_t tmp, buf_len; - tmp = object-u.cp.offset; + tmp = object-u.cp.start; if (object-flags ITER_REVERSE) { U16_PREV(object-text, 0, tmp, cp); } else { @@ -191,9 +130,9 @@ static void text_iter_cp_next(text_iter_obj* object TSRMLS_DC) { if (object-flags ITER_REVERSE) { - U16_BACK_1(object-text, 0, object-u.cp.offset); + U16_BACK_1(object-text, 0, object-u.cp.start); } else { -
[PHP-CVS] cvs: php-src /ext/reflection php_reflection.c
helly Sat Jun 24 18:53:51 2006 UTC Modified files: /php-src/ext/reflection php_reflection.c Log: - Fix ReflectionObject::getProperties() + dyn properties http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.236r2=1.237diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.236 php-src/ext/reflection/php_reflection.c:1.237 --- php-src/ext/reflection/php_reflection.c:1.236 Sun Jun 11 23:46:53 2006 +++ php-src/ext/reflection/php_reflection.c Sat Jun 24 18:53:51 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.236 2006/06/11 23:46:53 bjori Exp $ */ +/* $Id: php_reflection.c,v 1.237 2006/06/24 18:53:51 helly Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -3106,6 +3106,34 @@ } /* }}} */ +/* {{{ _adddynproperty */ +static int _adddynproperty(zval **pptr, int num_args, va_list args, zend_hash_key *hash_key) +{ + zval *property; + zend_class_entry *ce = *va_arg(args, zend_class_entry**); + zval *retval = va_arg(args, zval*), member; + TSRMLS_FETCH(); + + if (hash_key-type == IS_UNICODE) { + if (hash_key-arKey.u[0] == 0) { + return 0; /* non public cannot be dynamic */ + } + ZVAL_UNICODEL(member, hash_key-arKey.u, hash_key-nKeyLength-1, 0); + } else { + if (hash_key-arKey.s[0] == '\0') { + return 0; /* non public cannot be dynamic */ + } + ZVAL_STRINGL(member, hash_key-arKey.s, hash_key-nKeyLength-1, 0); + } + if (zend_get_property_info(ce, member, 1 TSRMLS_CC) == EG(std_property_info)) { + ALLOC_ZVAL(property); + reflection_property_factory(ce, EG(std_property_info), property TSRMLS_CC); + add_next_index_zval(retval, property); + } + return 0; +} +/* }}} */ + /* {{{ proto public ReflectionProperty[] ReflectionClass::getProperties() Returns an array of this class' properties */ ZEND_METHOD(reflection_class, getProperties) @@ -3129,6 +3157,11 @@ array_init(return_value); zend_hash_apply_with_arguments(ce-properties_info, (apply_func_args_t) _addproperty, 3, ce, return_value, filter); + + if (intern-obj (filter ZEND_ACC_PUBLIC) != 0 Z_OBJ_HT_P(intern-obj)-get_properties) { + HashTable *properties = Z_OBJ_HT_P(intern-obj)-get_properties(intern-obj TSRMLS_CC); + zend_hash_apply_with_arguments(properties, (apply_func_args_t) _adddynproperty, 2, ce, return_value); + } } /* }}} */ @@ -4775,7 +4808,7 @@ php_info_print_table_start(); php_info_print_table_header(2, Reflection, enabled); - php_info_print_table_row(2, Version, $Id: php_reflection.c,v 1.236 2006/06/11 23:46:53 bjori Exp $); + php_info_print_table_row(2, Version, $Id: php_reflection.c,v 1.237 2006/06/24 18:53:51 helly Exp $); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/reflection php_reflection.c
helly Sat Jun 24 18:55:15 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/reflection php_reflection.c Log: - MFH Fix ReflectionObject::getProperties() + dyn properties http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.7r2=1.164.2.33.2.8diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.7 php-src/ext/reflection/php_reflection.c:1.164.2.33.2.8 --- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.7 Sat Jun 10 00:40:56 2006 +++ php-src/ext/reflection/php_reflection.c Sat Jun 24 18:55:15 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_reflection.c,v 1.164.2.33.2.7 2006/06/10 00:40:56 bjori Exp $ */ +/* $Id: php_reflection.c,v 1.164.2.33.2.8 2006/06/24 18:55:15 helly Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -3078,6 +3078,28 @@ } /* }}} */ +/* {{{ _adddynproperty */ +static int _adddynproperty(zval **pptr, int num_args, va_list args, zend_hash_key *hash_key) +{ + zval *property; + zend_class_entry *ce = *va_arg(args, zend_class_entry**); + zval *retval = va_arg(args, zval*), member; + TSRMLS_FETCH(); + + if (hash_key-arKey[0] == '\0') { + return 0; /* non public cannot be dynamic */ + } + + ZVAL_STRINGL(member, hash_key-arKey, hash_key-nKeyLength-1, 0); + if (zend_get_property_info(ce, member, 1 TSRMLS_CC) == EG(std_property_info)) { + ALLOC_ZVAL(property); + reflection_property_factory(ce, EG(std_property_info), property TSRMLS_CC); + add_next_index_zval(retval, property); + } + return 0; +} +/* }}} */ + /* {{{ proto public ReflectionProperty[] ReflectionClass::getProperties() Returns an array of this class' properties */ ZEND_METHOD(reflection_class, getProperties) @@ -3101,6 +3123,11 @@ array_init(return_value); zend_hash_apply_with_arguments(ce-properties_info, (apply_func_args_t) _addproperty, 3, ce, return_value, filter); + + if (intern-obj (filter ZEND_ACC_PUBLIC) != 0 Z_OBJ_HT_P(intern-obj)-get_properties) { + HashTable *properties = Z_OBJ_HT_P(intern-obj)-get_properties(intern-obj TSRMLS_CC); + zend_hash_apply_with_arguments(properties, (apply_func_args_t) _adddynproperty, 2, ce, return_value); + } } /* }}} */ @@ -4713,7 +4740,7 @@ php_info_print_table_start(); php_info_print_table_header(2, Reflection, enabled); - php_info_print_table_row(2, Version, $Id: php_reflection.c,v 1.164.2.33.2.7 2006/06/10 00:40:56 bjori Exp $); + php_info_print_table_row(2, Version, $Id: php_reflection.c,v 1.164.2.33.2.8 2006/06/24 18:55:15 helly Exp $); php_info_print_table_end(); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/unicode unicode_iterators.c
andrei Sat Jun 24 21:57:14 2006 UTC Modified files: /php-src/ext/unicodeunicode_iterators.c Log: A lot of work on making TextIterator support propert codepoint-level offsets and making it more robust in general. http://cvs.php.net/viewvc.cgi/php-src/ext/unicode/unicode_iterators.c?r1=1.25r2=1.26diff_format=u Index: php-src/ext/unicode/unicode_iterators.c diff -u php-src/ext/unicode/unicode_iterators.c:1.25 php-src/ext/unicode/unicode_iterators.c:1.26 --- php-src/ext/unicode/unicode_iterators.c:1.25Sat Jun 24 18:18:38 2006 +++ php-src/ext/unicode/unicode_iterators.c Sat Jun 24 21:57:14 2006 @@ -14,11 +14,12 @@ +--+ */ -/* $Id: unicode_iterators.c,v 1.25 2006/06/24 18:18:38 andrei Exp $ */ +/* $Id: unicode_iterators.c,v 1.26 2006/06/24 21:57:14 andrei Exp $ */ /* * TODO * + * - test with empty and 1 character strings * - optimize current() to pass return_value to the handler so that it fills it * in directly instead of creating a new zval * - implement Countable (or count_elements handler) and Seekable interfaces @@ -51,20 +52,23 @@ size_t current_alloc; longflags; union { - int32_t start; struct { - int32_t start; + int32_t offset; + int32_t cp_offset; int32_t index; } cp; struct { int32_t start; int32_t end; int32_t index; + int32_t start_cp_offset; + int32_t end_cp_offset; } cs; struct { int32_t start; int32_t end; int32_t index; + int32_t cp_offset; UBreakIterator *iter; } brk; } u; @@ -77,11 +81,12 @@ } typedef struct { - int (*valid) (text_iter_obj* object TSRMLS_DC); - void (*current)(text_iter_obj* object TSRMLS_DC); - int (*key)(text_iter_obj* object TSRMLS_DC); - void (*next) (text_iter_obj* object TSRMLS_DC); - void (*rewind) (text_iter_obj* object TSRMLS_DC); + int (*valid) (text_iter_obj* object, long flags TSRMLS_DC); + void (*current)(text_iter_obj* object, long flags TSRMLS_DC); + int (*key)(text_iter_obj* object, long flags TSRMLS_DC); + int (*offset) (text_iter_obj* object, long flags TSRMLS_DC); + void (*next) (text_iter_obj* object, long flags TSRMLS_DC); + void (*rewind) (text_iter_obj* object, long flags TSRMLS_DC); } text_iter_ops; enum UBreakIteratorType brk_type_map[] = { @@ -97,52 +102,65 @@ /* Code point ops */ -static int text_iter_cp_valid(text_iter_obj* object TSRMLS_DC) +static int text_iter_cp_valid(text_iter_obj* object, long flags TSRMLS_DC) { - if (object-flags ITER_REVERSE) { - return (object-u.cp.start 0); + if (flags ITER_REVERSE) { + return (object-u.cp.offset 0); } else { - return (object-u.cp.start object-text_len); + return (object-u.cp.offset object-text_len); } } -static void text_iter_cp_current(text_iter_obj* object TSRMLS_DC) +static void text_iter_cp_current(text_iter_obj* object, long flags TSRMLS_DC) { - UChar32 cp; - int32_t tmp, buf_len; + UChar32 cp = 0; + int32_t tmp, buf_len = 0; - tmp = object-u.cp.start; - if (object-flags ITER_REVERSE) { - U16_PREV(object-text, 0, tmp, cp); - } else { - U16_NEXT(object-text, tmp, object-text_len, cp); + if (text_iter_cp_valid(object, flags TSRMLS_CC)) { + tmp = object-u.cp.offset; + if (flags ITER_REVERSE) { + U16_PREV(object-text, 0, tmp, cp); + } else { + U16_NEXT(object-text, tmp, object-text_len, cp); + } + buf_len = zend_codepoint_to_uchar(cp, Z_USTRVAL_P(object-current)); } - buf_len = zend_codepoint_to_uchar(cp, Z_USTRVAL_P(object-current)); Z_USTRVAL_P(object-current)[buf_len] = 0; Z_USTRLEN_P(object-current) = buf_len; } -static int text_iter_cp_key(text_iter_obj* object TSRMLS_DC) +static int text_iter_cp_key(text_iter_obj* object, long flags TSRMLS_DC) { return object-u.cp.index; } -static void text_iter_cp_next(text_iter_obj* object TSRMLS_DC) +static int text_iter_cp_offset(text_iter_obj* object, long flags TSRMLS_DC) { - if (object-flags ITER_REVERSE) { - U16_BACK_1(object-text, 0, object-u.cp.start); - } else { - U16_FWD_1(object-text, object-u.cp.start, object-text_len); +