Changeset 496 for trunk/utils.c
- Timestamp:
- 01/04/2008 11:38:57 AM (11 months ago)
- Files:
-
- 1 modified
-
trunk/utils.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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);

