]> granicus.if.org Git - php/commitdiff
Fixed Bug #40274 (Sessions fail with numeric root keys).
authorIlia Alshanetsky <iliaa@php.net>
Tue, 6 Feb 2007 00:01:18 +0000 (00:01 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 6 Feb 2007 00:01:18 +0000 (00:01 +0000)
NEWS
ext/session/php_session.h

diff --git a/NEWS b/NEWS
index 2fcf90cffb0c890d3638b36e7414522104efea39..44023082c2795dce6022ca1b17a09297de5cc4d8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -103,6 +103,7 @@ PHP                                                                        NEWS
   missing). (Tony)
 - Fixed bug #40285 (The PDO prepare parser goes into an infinite loop in
   some instances). (Ilia)
+- Fixed Bug #40274 (Sessions fail with numeric root keys). (Ilia)
 - Fixed bug #40259 (ob_start call many times - memory error). (Dmitry)
 - Fixed bug #40231 (file_exists incorrectly reports false). (Dmitry)
 - Fixed bug #40228 (ZipArchive::extractTo does create empty directories 
index f0e365cffbcfb4a534733e7ca66769f5d8c49deb..0ad48e8fa8578a9a23f4440630177126cdf524f1 100644 (file)
@@ -223,11 +223,16 @@ PHPAPI const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC);
 
 #define PS_ENCODE_LOOP(code) do {                                                                      \
                HashTable *_ht = Z_ARRVAL_P(PS(http_session_vars)); \
+               int key_type;                                           \
                                                                                                                                        \
                for (zend_hash_internal_pointer_reset(_ht);                     \
-                               zend_hash_get_current_key_ex(_ht, &key, &key_length, &num_key, 0, NULL) == HASH_KEY_IS_STRING; \
+                               (key_type = zend_hash_get_current_key_ex(_ht, &key, &key_length, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTANT; \
                                zend_hash_move_forward(_ht)) {                          \
-                               key_length--;                                                                           \
+                       if (key_type == HASH_KEY_IS_LONG) {                                             \
+                               php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Skipping numeric key %ld.", num_key); \
+                               continue;                                                               \
+                       }                                                                               \
+                       key_length--;                                                                           \
                        if (php_get_session_var(key, key_length, &struc TSRMLS_CC) == SUCCESS) { \
                                code;                                                                                           \
                        }                                                                                                               \