tony2001                Thu Feb 15 09:41:31 2007 UTC

  Modified files:              (Branch: PHP_4_4)
    /php-src/ext/session        session.c 
    /php-src/ext/session/tests  002.phpt 
  Log:
  fix segfault in php_add_session_var()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/session/session.c?r1=1.336.2.53.2.13&r2=1.336.2.53.2.14&diff_format=u
Index: php-src/ext/session/session.c
diff -u php-src/ext/session/session.c:1.336.2.53.2.13 
php-src/ext/session/session.c:1.336.2.53.2.14
--- php-src/ext/session/session.c:1.336.2.53.2.13       Tue Jan  9 15:31:36 2007
+++ php-src/ext/session/session.c       Thu Feb 15 09:41:30 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: session.c,v 1.336.2.53.2.13 2007/01/09 15:31:36 iliaa Exp $ */
+/* $Id: session.c,v 1.336.2.53.2.14 2007/02/15 09:41:30 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -271,8 +271,12 @@
 {
        zval **sym_track = NULL;
        
-       zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name, namelen + 1, 
-                       (void *) &sym_track);
+       IF_SESSION_VARS() {
+               zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name, namelen 
+ 1,
+                               (void *) &sym_track);
+       } else {
+               return;
+       }
 
        /*
         * Set up a proper reference between $_SESSION["x"] and $x.
@@ -281,11 +285,10 @@
        if (PG(register_globals)) {
                zval **sym_global = NULL;
                
-               zend_hash_find(&EG(symbol_table), name, namelen + 1, 
-                               (void *) &sym_global);
-                               
-               if ((Z_TYPE_PP(sym_global) == IS_ARRAY && 
Z_ARRVAL_PP(sym_global) == &EG(symbol_table)) || *sym_global == 
PS(http_session_vars)) {
-                       return;
+               if (zend_hash_find(&EG(symbol_table), name, namelen + 1, (void 
*) &sym_global) == SUCCESS) {
+                       if ((Z_TYPE_PP(sym_global) == IS_ARRAY && 
Z_ARRVAL_PP(sym_global) == &EG(symbol_table)) || *sym_global == 
PS(http_session_vars)) {
+                               return;
+                       }
                }
 
                if (sym_global == NULL && sym_track == NULL) {
http://cvs.php.net/viewvc.cgi/php-src/ext/session/tests/002.phpt?r1=1.5&r2=1.5.12.1&diff_format=u
Index: php-src/ext/session/tests/002.phpt
diff -u php-src/ext/session/tests/002.phpt:1.5 
php-src/ext/session/tests/002.phpt:1.5.12.1
--- php-src/ext/session/tests/002.phpt:1.5      Thu Oct  3 16:14:54 2002
+++ php-src/ext/session/tests/002.phpt  Thu Feb 15 09:41:31 2007
@@ -7,6 +7,7 @@
 error_reporting(E_ALL);
 session_unset();
 print "ok\n";
+?>
 --GET--
 --POST--
 --EXPECT--

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

Reply via email to