Commit:    f877d7fee6efe6457e665e60f99fc2f524d26d52
Author:    Dmitry Stogov <dmi...@zend.com>         Thu, 29 Nov 2012 12:38:34 
+0400
Parents:   c37d7a9456ff12fc60654a2b33aadedfcf6e7476 
92e2f2938115d2cdae185848d535380fb7694598
Branches:  PHP-5.4

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=f877d7fee6efe6457e665e60f99fc2f524d26d52

Log:
Merge branch 'PHP-5.3' into PHP-5.4

* PHP-5.3:
  Fixed bug #63635 (Segfault in gc_collect_cycles)

Conflicts:
        NEWS

Bugs:
https://bugs.php.net/63635

Changed paths:
  MM  NEWS
  MM  Zend/zend_gc.c


Diff:
diff --cc NEWS
index 79b4f28,09b9995..20ef5e3
--- a/NEWS
+++ b/NEWS
@@@ -1,24 -1,24 +1,25 @@@
  PHP                                                                        
NEWS
  
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 -?? ??? 2012, PHP 5.3.20
 +?? ??? 2012, PHP 5.4.10
  
 -- Zend Engine:
 +- Core:
+   . Fixed bug #63635 (Segfault in gc_collect_cycles). (Dmitry)
 -  . Fixed bug #63512 (parse_ini_file() with INI_SCANNER_RAW removes quotes 
 -    from value). (Pierrick)
    . Fixed bug #63468 (wrong called method as callback with inheritance).
      (Laruence)
 +  . Fixed bug #61272 (ob_start callback gets passed empty string).
 +    (Mike, casper at langemeijer dot eu)
  
 -- Core:
 -  . Fixed bug #63451 (config.guess file does not have AIX 7 defined, 
 -    shared objects are not created). (kemcline at au1 dot ibm dot com)
 +- Imap:
 +  . Fixed Bug #63126 DISABLE_AUTHENTICATOR ignores array (Remi)
  
 -- Apache2 Handler SAPI:
 -  . Enabled Apache 2.4 configure option for Windows (Pierre, Anatoliy)
 +- Json:
 +  . Fixed bug #63588 use php_next_utf8_char and remove duplicate
 +    implementation. (Remi)
 +
 +- mysqli:
 +  . Fixed bug #63361 missing header. (Remi)
  
  - Fileinfo:
 -  . Fixed bug #63248 (Load multiple magic files from a directory under 
Windows).
 -    (Anatoliy)
    . Fixed bug #63590 (Different results in TS and NTS under Windows).
      (Anatoliy)
  
diff --cc Zend/zend_gc.c
index 84a99c1,2b27de8..e877eab
--- a/Zend/zend_gc.c
+++ b/Zend/zend_gc.c
@@@ -644,37 -553,13 +644,38 @@@ tail_call
                        struct _store_object *obj = 
&EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].bucket.obj;
  
                        if (obj->buffered == (gc_root_buffer*)GC_WHITE) {
-                               GC_SET_BLACK(obj->buffered);
+                               /* PURPLE instead of BLACK to prevent buffering 
in nested gc calls */
+                               GC_SET_PURPLE(obj->buffered);
  
                                if 
(EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
 -                                           Z_OBJ_HANDLER_P(pz, 
get_properties) != NULL)) {
 -                                      HashTable *props = Z_OBJPROP_P(pz);
 -                                      if(!props) {
 +                                           (get_gc = Z_OBJ_HANDLER_P(pz, 
get_gc)) != NULL)) {
 +                                      int i, n;
 +                                      zval **table, *zv;
 +                                      HashTable *props = get_gc(pz, &table, 
&n TSRMLS_CC);
 +
 +                                      if (!props) {
 +                                              /* restore refcount and put 
into list to free */
 +                                              pz->refcount__gc++;
 +                                              ((zval_gc_info*)pz)->u.next = 
GC_G(zval_to_free);
 +                                              GC_G(zval_to_free) = 
(zval_gc_info*)pz;
 +                                      }
 +
 +                                      while (n > 0 && !table[n-1]) n--;
 +                                      for (i = 0; i < n; i++) {
 +                                              if (table[i]) {
 +                                                      zv = table[i];
 +                                                      if (Z_TYPE_P(zv) != 
IS_ARRAY || Z_ARRVAL_P(zv) != &EG(symbol_table)) {
 +                                                              
zv->refcount__gc++;
 +                                                      }
 +                                                      if (!props && i == n - 
1) {
 +                                                              pz = zv;
 +                                                              goto tail_call;
 +                                                      } else {
 +                                                              
zval_collect_white(zv TSRMLS_CC);
 +                                                      }
 +                                              }
 +                                      }
 +                                      if (!props) {
                                                return;
                                        }
                                        p = props->pListHead;
@@@ -715,24 -599,13 +716,25 @@@ static void zobj_collect_white(zval *p
                struct _store_object *obj = 
&EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].bucket.obj;
  
                if (obj->buffered == (gc_root_buffer*)GC_WHITE) {
-                       GC_SET_BLACK(obj->buffered);
+                       /* PURPLE instead of BLACK to prevent buffering in 
nested gc calls */
+                       GC_SET_PURPLE(obj->buffered);
  
                        if 
(EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
 -                                   Z_OBJ_HANDLER_P(pz, get_properties) != 
NULL)) {
 -                              HashTable *props = Z_OBJPROP_P(pz);
 -                              if(!props) {
 +                                   (get_gc = Z_OBJ_HANDLER_P(pz, get_gc)) != 
NULL)) {
 +                              int i, n;
 +                              zval **table;
 +                              HashTable *props = get_gc(pz, &table, &n 
TSRMLS_CC);
 +
 +                              for (i = 0; i < n; i++) {
 +                                      if (table[i]) {
 +                                              pz = table[i];
 +                                              if (Z_TYPE_P(pz) != IS_ARRAY || 
Z_ARRVAL_P(pz) != &EG(symbol_table)) {
 +                                                      pz->refcount__gc++;
 +                                              }
 +                                              zval_collect_white(pz 
TSRMLS_CC);
 +                                      }
 +                              }
 +                              if (!props) {
                                        return;
                                }
                                p = props->pListHead;


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to