Changeset 496
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r492 r496 6 6 ChangeLog 7 7 ======== 8 * compiler errors: all compiler warning (e.g.: E_STRICT) is now cached and is supported for user handler 8 9 * added module dependency 9 10 * live with wrong system time: allow caching files with mtime in further -
trunk/processor/processor.m4
r495 r496 741 741 dnl }}} 742 742 #endif 743 #ifdef E_STRICT 744 DEF_STRUCT_P_FUNC(`xc_compilererror_t', , `dnl {{{ 745 DISPATCH(int, type) 746 DISPATCH(uint, lineno) 747 DISPATCH(int, error_len) 748 PROC_STRING_L(error, error_len) 749 ') 750 dnl }}} 751 #endif 743 752 DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{ 744 753 zend_uint i; … … 790 799 ') 791 800 #endif 801 #ifdef E_STRICT 802 DISPATCH(zend_uint, compilererror_cnt) 803 IFRESTORE(` 804 COPY(compilererrors) 805 ', ` 806 STRUCT_ARRAY(compilererror_cnt, xc_compilererror_t, compilererrors) 807 ') 808 #endif 792 809 DISPATCH(zend_bool, have_early_binding) 793 810 DISPATCH(zend_bool, have_references) -
trunk/utils.c
r485 r496 517 517 #define OG(x) (sandbox->orig_##x) 518 518 /* }}} */ 519 #ifdef E_STRICT 520 static void xc_sandbox_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) /* {{{ */ 521 { 522 xc_compilererror_t *compilererror; 523 xc_sandbox_t *sandbox; 524 TSRMLS_FETCH(); 525 526 sandbox = (xc_sandbox_t *) XG(sandbox); 527 assert(sandbox != NULL); 528 if (sandbox->compilererror_cnt <= sandbox->compilererror_size) { 529 if (sandbox->compilererror_size) { 530 sandbox->compilererror_size += 16; 531 sandbox->compilererrors = erealloc(sandbox->compilererrors, sandbox->compilererror_size * sizeof(sandbox->compilererrors)); 532 } 533 else { 534 sandbox->compilererror_size = 16; 535 sandbox->compilererrors = emalloc(sandbox->compilererror_size * sizeof(sandbox->compilererrors)); 536 } 537 } 538 compilererror = &sandbox->compilererrors[sandbox->compilererror_cnt++]; 539 compilererror->type = type; 540 compilererror->lineno = error_lineno; 541 compilererror->error_len = zend_vspprintf(&compilererror->error, 0, format, args); 542 } 543 /* }}} */ 544 #endif 519 545 #ifdef ZEND_ENGINE_2_1 520 546 static zend_bool xc_auto_global_callback(char *name, uint name_len TSRMLS_DC) /* {{{ */ … … 622 648 #ifdef E_STRICT 623 649 sandbox->orig_user_error_handler_error_reporting = EG(user_error_handler_error_reporting); 624 EG(user_error_handler_error_reporting) &= ~E_STRICT; 625 #endif 626 650 EG(user_error_handler_error_reporting) = 0; 651 652 sandbox->compilererror_cnt = 0; 653 sandbox->compilererror_size = 0; 654 sandbox->orig_zend_error_cb = zend_error_cb; 655 zend_error_cb = xc_sandbox_error_cb; 656 #endif 657 658 XG(sandbox) = (void *) sandbox; 627 659 return sandbox; 628 660 } … … 684 716 } 685 717 718 #ifdef E_STRICT 719 /* restore trigger errors */ 720 for (i = 0; i < sandbox->compilererror_cnt; i ++) { 721 xc_compilererror_t *error = &sandbox->compilererrors[i]; 722 CG(zend_lineno) = error->lineno; 723 zend_error(error->type, "%s", error->error); 724 } 725 CG(zend_lineno) = 0; 726 #endif 727 686 728 i = 1; 687 729 zend_hash_add(&OG(included_files), sandbox->filename, strlen(sandbox->filename) + 1, (void *)&i, sizeof(int), NULL); … … 690 732 void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC) /* {{{ */ 691 733 { 734 XG(sandbox) = NULL; 735 #ifdef E_STRICT 736 EG(user_error_handler_error_reporting) = sandbox->orig_user_error_handler_error_reporting; 737 zend_error_cb = sandbox->orig_zend_error_cb; 738 #endif 739 692 740 /* restore first first install function/class */ 693 741 #ifdef HAVE_XCACHE_CONSTANT … … 731 779 memcpy(&EG(included_files), &OG(included_files), sizeof(EG(included_files))); 732 780 733 #ifdef E_STRICT 734 EG(user_error_handler_error_reporting) = sandbox->orig_user_error_handler_error_reporting; 735 #endif 736 781 if (sandbox->compilererrors) { 782 int i; 783 for (i = 0; i < sandbox->compilererror_cnt; i ++) { 784 efree(sandbox->compilererrors[i].error); 785 } 786 efree(sandbox->compilererrors); 787 } 737 788 if (sandbox->alloc) { 738 789 efree(sandbox); -
trunk/utils.h
r405 r496 80 80 typedef struct { 81 81 int alloc; 82 int orig_user_error_handler_error_reporting;83 82 char *filename; 84 83 … … 98 97 Bucket *tmp_internal_function_tail; 99 98 Bucket *tmp_internal_class_tail; 99 100 #ifdef E_STRICT 101 int orig_user_error_handler_error_reporting; 102 ZEND_API void (*orig_zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); 103 zend_uint compilererror_cnt; 104 zend_uint compilererror_size; 105 xc_compilererror_t *compilererrors; 106 #endif 100 107 } xc_sandbox_t; 101 108 -
trunk/xcache-test.ini
r409 r496 1 display_error = On 1 2 auto_globals_jit = Off 2 3 -
trunk/xcache.c
r495 r496 664 664 zend_u_is_auto_global(aginfo->type, aginfo->key, aginfo->key_len TSRMLS_CC); 665 665 } 666 #endif 667 #ifdef E_STRICT 668 /* restore trigger errors */ 669 for (i = 0; i < p->compilererror_cnt; i ++) { 670 xc_compilererror_t *error = &p->compilererrors[i]; 671 CG(zend_lineno) = error->lineno; 672 zend_error(error->type, "%s", error->error); 673 } 674 CG(zend_lineno) = 0; 666 675 #endif 667 676 … … 1115 1124 } 1116 1125 /* }}} */ 1126 #ifdef E_STRICT 1127 php->compilererrors = ((xc_sandbox_t *) XG(sandbox))->compilererrors; 1128 php->compilererror_cnt = ((xc_sandbox_t *) XG(sandbox))->compilererror_cnt; 1129 #endif 1117 1130 /* {{{ find inherited classes that should be early-binding */ 1118 1131 php->have_early_binding = 0; -
trunk/xcache.h
r491 r496 266 266 typedef enum { XC_TYPE_PHP, XC_TYPE_VAR } xc_entry_type_t; 267 267 typedef char xc_md5sum_t[16]; 268 /* {{{ xc_compilererror_t */ 269 typedef struct { 270 int type; 271 uint lineno; 272 int error_len; 273 char *error; 274 } xc_compilererror_t; 275 /* }}} */ 268 276 /* {{{ xc_entry_data_php_t */ 269 277 struct _xc_entry_data_php_t { … … 296 304 zend_uint autoglobal_cnt; 297 305 xc_autoglobal_t *autoglobals; 306 #endif 307 308 #ifdef E_STRICT 309 zend_uint compilererror_cnt; 310 xc_compilererror_t *compilererrors; 298 311 #endif 299 312 -
trunk/xcache_globals.h
r435 r496 21 21 HashTable internal_class_table; 22 22 zend_bool internal_table_copied; 23 24 void *sandbox; 23 25 ZEND_END_MODULE_GLOBALS(xcache) 24 26

