]> granicus.if.org Git - php/commitdiff
Print out warning only, if a variable was actually migrated
authorSascha Schumann <sas@php.net>
Mon, 7 Oct 2002 02:37:50 +0000 (02:37 +0000)
committerSascha Schumann <sas@php.net>
Mon, 7 Oct 2002 02:37:50 +0000 (02:37 +0000)
ext/session/session.c

index 8dce8245a559ffd359507f4c9174a7956fb44b07..08e717058b66d7c14664016fe653b52eaafc84cc 100644 (file)
@@ -611,13 +611,14 @@ static void php_session_initialize(TSRMLS_D)
        }
 }
 
-static void migrate_global(HashTable *ht, HashPosition *pos TSRMLS_DC)
+static int migrate_global(HashTable *ht, HashPosition *pos TSRMLS_DC)
 {
        char *str;
        uint str_len;
        ulong num_key;
        int n;
        zval **val = NULL;
+       int ret = 0;
        
        n = zend_hash_get_current_key_ex(ht, &str, &str_len, &num_key, 0, pos);
 
@@ -626,6 +627,7 @@ static void migrate_global(HashTable *ht, HashPosition *pos TSRMLS_DC)
                        zend_hash_find(&EG(symbol_table), str, str_len, (void **) &val);
                        if (val) {
                                ZEND_SET_SYMBOL_WITH_LENGTH(ht, str, str_len, *val, (*val)->refcount + 1 , 1);
+                               ret = 1;
                        }
                        break;
                case HASH_KEY_IS_LONG:
@@ -634,6 +636,8 @@ static void migrate_global(HashTable *ht, HashPosition *pos TSRMLS_DC)
                                        "numeric nature.", num_key);
                        break;
        }
+       
+       return ret;
 }
 
 static void php_session_save_current_state(TSRMLS_D)
@@ -652,9 +656,8 @@ static void php_session_save_current_state(TSRMLS_D)
                        while (zend_hash_get_current_data_ex(ht, 
                                                (void **) &val, &pos) != FAILURE) {
                                if (Z_TYPE_PP(val) == IS_NULL) {
-                                       do_warn = 1;
-
-                                       migrate_global(ht, &pos TSRMLS_CC);
+                                       if (migrate_global(ht, &pos TSRMLS_CC))
+                                               do_warn = 1;
                                }
                                zend_hash_move_forward_ex(ht, &pos);
                        }