]> granicus.if.org Git - php/commitdiff
Passing symbol_table into user error handlers
authorDmitry Stogov <dmitry@zend.com>
Tue, 4 Mar 2014 10:17:17 +0000 (14:17 +0400)
committerDmitry Stogov <dmitry@zend.com>
Tue, 4 Mar 2014 10:17:17 +0000 (14:17 +0400)
Zend/zend.c
Zend/zend_hash.c

index dd03ea6caa855c5ba3c9d5752b88caacf2413102..75abcf3b645349893edf1d9daefb2b3a4a5a1370 100644 (file)
@@ -1181,13 +1181,8 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
                        if (!EG(active_symbol_table)) {
                                ZVAL_NULL(&params[4]);
                        } else {
-//???
-#if 1
-                               ZVAL_NULL(&params[4]);
-#else
-                               ZVAL_ARR(&params[4], EG(active_symbol_table));
-                               zval_copy_ctor(&params[4]);
-#endif
+                               array_init_size(&params[4], zend_hash_num_elements(EG(active_symbol_table)));
+                               zend_hash_copy(Z_ARRVAL(params[4]), EG(active_symbol_table), zval_add_ref);
                        }
 
                        ZVAL_COPY_VALUE(&orig_user_error_handler, &EG(user_error_handler));
index 1b6b6e0678a6280f3aadf711bed0612a7ef8d1e4..0f424cb8eb452945c139bd1710351df940d98dc1 100644 (file)
@@ -99,6 +99,7 @@ ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor,
 {
        uint i = 3;
 
+       ht->flags = 0;
        SET_INCONSISTENT(HT_OK);
 
        if (nSize >= 0x80000000) {
@@ -119,7 +120,7 @@ ZEND_API int _zend_hash_init(HashTable *ht, uint nSize, dtor_func_t pDestructor,
        ht->nNumOfElements = 0;
        ht->nNextFreeElement = 0;
        ht->nInternalPointer = INVALID_IDX;
-       ht->flags = HASH_FLAG_APPLY_PROTECTION;
+       ht->flags |= HASH_FLAG_APPLY_PROTECTION;
        if (persistent) {
                ht->flags |= HASH_FLAG_PERSISTENT;
        }