[PHP-DEV] CVS update: php3 From: zeev (php-dev <email protected>)
Date: 04/29/98

Date: Wednesday April 29, 1998 @ 17:51
Author: zeev

Update of /repository/php3
In directory asf:/tmp/cvs-serv17796

Modified Files:
        ChangeLog control_structures_inline.h parser.h
Log Message:
Fix static variables inside object methods

Index: php3/ChangeLog
diff -c php3/ChangeLog:1.310 php3/ChangeLog:1.311
*** php3/ChangeLog:1.310 Wed Apr 29 10:24:27 1998
--- php3/ChangeLog Wed Apr 29 17:51:23 1998
***************
*** 1,6 ****
--- 1,9 ----
  PHP 3.0 CHANGE LOG ChangeLog
  |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  April ?? Version 3.0
+ - Fixed static variables inside class member functions. Note that using such
+ static variables inside member functions usually defeats the purpose of
+ objects, so it is not recommended.
  - Fixed a bug in fpassthru() (the file was being closed twice).
  - Added strftime().
  - Add set_blocking() function to control blocking on socket fd's
Index: php3/control_structures_inline.h
diff -c php3/control_structures_inline.h:1.162 php3/control_structures_inline.h:1.163
*** php3/control_structures_inline.h:1.162 Wed Apr 29 09:22:35 1998
--- php3/control_structures_inline.h Wed Apr 29 17:51:24 1998
***************
*** 29,35 ****
   */
  
  
! /* $Id: control_structures_inline.h,v 1.162 1998/04/29 13:22:35 ssb Exp $ */
  
  #ifdef THREAD_SAFE
  #include "tls.h"
--- 29,35 ----
   */
  
  
! /* $Id: control_structures_inline.h,v 1.163 1998/04/29 21:51:24 zeev Exp $ */
  
  #ifdef THREAD_SAFE
  #include "tls.h"
***************
*** 166,172 ****
                          php3_error(E_WARNING, "Incorrect variable type or name in static in function %s()", GLOBAL(function_state).function_name);
                          return FAILURE;
                  }
! if (hash_find(&GLOBAL(function_table), GLOBAL(function_state).function_name, strlen(GLOBAL(function_state).function_name)+1, (void **) &func_ent) == FAILURE) {
                          STR_FREE(varname->value.str.val);
                          if (value) {
                                  yystype_destructor(value _INLINE_TLS);
--- 166,172 ----
                          php3_error(E_WARNING, "Incorrect variable type or name in static in function %s()", GLOBAL(function_state).function_name);
                          return FAILURE;
                  }
! if (hash_find(GLOBAL(function_state).hosting_function_table, GLOBAL(function_state).function_name, strlen(GLOBAL(function_state).function_name)+1, (void **) &func_ent) == FAILURE) {
                          STR_FREE(varname->value.str.val);
                          if (value) {
                                  yystype_destructor(value _INLINE_TLS);
***************
*** 850,855 ****
--- 850,856 ----
                          GLOBAL(function_state).handler = (void (*)(INTERNAL_FUNCTION_PARAMETERS)) data->value.func.addr.internal;
                          GLOBAL(function_state).func_arg_types = data->value.func.arg_types;
                          GLOBAL(function_state).lineno = GLOBAL(current_lineno);
+ GLOBAL(function_state).hosting_function_table = target_symbol_table;
                          if (!GLOBAL(function_state).function_symbol_table) {
                                  php3_error(E_ERROR, "Unable to allocate necessary memory for function call");
                                  function_name->cs_data.function_call_type=0;
Index: php3/parser.h
diff -c php3/parser.h:1.260 php3/parser.h:1.261
*** php3/parser.h:1.260 Wed Apr 29 09:22:44 1998
--- php3/parser.h Wed Apr 29 17:51:25 1998
***************
*** 28,34 ****
     +----------------------------------------------------------------------+
   */
  
! /* $Id: parser.h,v 1.260 1998/04/29 13:22:44 ssb Exp $ */
  
  
  #ifndef _PARSER_H
--- 28,34 ----
     +----------------------------------------------------------------------+
   */
  
! /* $Id: parser.h,v 1.261 1998/04/29 21:51:25 zeev Exp $ */
  
  
  #ifndef _PARSER_H
***************
*** 395,400 ****
--- 395,401 ----
          int returned;
          HashTable *symbol_table;
          HashTable *function_symbol_table;
+ HashTable *hosting_function_table;
          unsigned char *func_arg_types;
          int lineno;
          char *function_name;