Permalink
Browse files

This commit was manufactured by cvs2svn to create tag

'BEFORE_NEW_OPERATOR_FIX'.
  • Loading branch information...
1 parent b1617d8 commit 5bfa70242fb1f579e33cd02d0a4088387176ba7c SVN Migration committed Jul 25, 1999
Showing with 1,906 additions and 9,079 deletions.
  1. +22 −0 ChangeLog
  2. +1 −1 Makefile.in
  3. +16 −1 Zend/zend.h
  4. +23 −3 Zend/zend_compile.c
  5. +59 −58 Zend/zend_compile.h
  6. +38 −7 Zend/zend_execute.c
  7. +1 −1 Zend/zend_execute.h
  8. +1 −6 Zend/zend_operators.c
  9. +38 −0 Zend/zend_stack.c
  10. +4 −0 Zend/zend_stack.h
  11. +1 −1 acconfig.h.in
  12. +24 −0 acinclude.m4
  13. +27 −4 buildconf
  14. +0 −997 config.guess
  15. +0 −979 config.sub
  16. +11 −9 configure.in.in
  17. +9 −9 ext/ereg/ereg.c
  18. +2 −2 ext/ereg/php_ereg.h
  19. +3 −0 ext/gd/config.h.stub
  20. +71 −13 ext/gd/config.m4
  21. +58 −33 ext/gd/gd.c
  22. +3 −3 ext/gd/gdcache.c
  23. +18 −2 ext/gd/gdttf.c
  24. +6 −1 ext/gd/php3_gd.h
  25. +17 −22 ext/informix/ifx.ec
  26. +2 −1 ext/standard/Makefile.am
  27. +226 −214 ext/standard/basic_functions.c
  28. +14 −14 ext/standard/basic_functions.h
  29. +1 −1 ext/standard/browscap.c
  30. +1 −1 ext/standard/crypt.c
  31. +31 −0 ext/standard/datetime.c
  32. +1 −0 ext/standard/datetime.h
  33. +5 −5 ext/standard/dir.c
  34. +1 −0 ext/standard/dl.c
  35. +2 −2 ext/standard/file.c
  36. +30 −29 ext/standard/filestat.c
  37. +3 −3 ext/standard/fsock.c
  38. +2 −2 ext/standard/head.c
  39. +1 −1 ext/standard/head.h
  40. +5 −5 ext/standard/link.c
  41. +1 −1 ext/standard/mail.c
  42. +1 −0 ext/standard/microtime.h
  43. +2 −2 ext/standard/pack.c
  44. +919 −0 ext/standard/parsedate.y
  45. +8 −7 ext/standard/php3_filestat.h
  46. +3 −2 ext/standard/php3_string.h
  47. +46 −4 ext/standard/rand.c
  48. +9 −9 ext/standard/reg.c
  49. +2 −2 ext/standard/reg.h
  50. +1 −1 ext/standard/soundex.c
  51. +2 −2 ext/standard/string.c
  52. +4 −4 ext/standard/syslog.c
  53. +2 −0 ext/wddx/wddx.c
  54. +1 −1 ext/xml/Makefile.am
  55. +10 −7 ext/xml/config.m4
  56. +0 −2,822 ltconfig
  57. +0 −3,779 ltmain.sh
  58. +12 −4 main/main.c
  59. +3 −1 main/php_version.h
  60. +1 −1 mod_php4.c
  61. BIN php4.gif
  62. +48 −0 php4.spec.in
  63. +24 −0 php4dll.dsp
  64. +28 −0 php4dllts.dsp
  65. +1 −0 scripts/mkextlib.in
View
@@ -2,6 +2,28 @@ PHP 4.0 CHANGE LOG ChangeLog
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
??? ?? 1999, Version 4.0 Beta 2
+- Fixed a problem with the PHP error handler that could result in a crash
+ on certain operating systems (Zeev)
+- Apache php_flag values only recognized 'On' (case sensitive) - changed
+ to case insensitive (Zeev)
+- Fixed a memory leak with switch statement containing return statements
+ (Andi & Zeev, libzend)
+- Fixed a crash problem in switch statements that had a string offset
+ as a conditional (Andi & Zeev, libzend)
+- Imported PHP3 fixes for rand() and mt_rand() (Rasmus)
+- Added function entries for strip_tags() and similar_text() (Andrey)
+- Fixed a bug in WDDX that would cause a crash if a number was passed in
+ instead of a variable name (Andrey)
+- Ported strtotime() function from PHP3 (Andrey)
+- Merged in gdttf stuff from php3 (Sascha)
+- buildconf now checks your installation (Stig)
+- XML module now built dynamically with --with-xml=shared (Stig)
+- Added a check for freetype.h - fixed build on RedHat 6.0 (Zeev)
+- Fixed array_walk() to work in PHP4 (Andrey)
+- Ported all remaining date() format options from PHP3 (Andrey)
+- $php_errormsg now works (Andrey)
+- Added locale support for Perl Compatible Regexp functions (Andrey)
+- Informix module ported (Danny)
- Removed --with-shared-apache (Sascha)
- Added patch for reverse lookup table in base64_decode (Sascha)
Submitted by bfranklin@dct.com
View
@@ -135,7 +135,7 @@ distclean: clean distclean-recursive
-rm -f *-parser.[ch] *-scanner.c *.output
-rm -f config.status config.cache config.log
-rm -f Makefile Makefile.depend php_config.h build-defs.h
- -rm -f libphp4.module stamp-h
+ -rm -f libphp4.module stamp-h buildconf.stamp
-rm -f regex/*.o regex/*.a regex/*.ih
-rm -f doc/checkdoc doc/funcparse doc/version.ent
-rm -f do-conf test/test.log
View
@@ -241,8 +241,23 @@ extern zend_utility_values zend_uv;
(z)->EA.is_ref = 0; \
(z)->EA.locks = 0;
-#define MAKE_STD_ZVAL(zv) \
+#define MAKE_STD_ZVAL(zv) \
zv = (zval *) emalloc(sizeof(zval)); \
INIT_PZVAL(zv);
+#define SEPARATE_ZVAL(ppzv) \
+ { \
+ zval *orig_ptr = *(ppzv); \
+ \
+ if (orig_ptr->refcount>1) { \
+ orig_ptr->refcount--; \
+ *(ppzv) = (zval *) emalloc(sizeof(zval)); \
+ **(ppzv) = *orig_ptr; \
+ zval_copy_ctor(*(ppzv)); \
+ (*(ppzv))->refcount=1; \
+ (*(ppzv))->EA.is_ref = 0; \
+ (*(ppzv))->EA.locks = 0; \
+ } \
+ }
+
#endif /* _ZEND_H */
View
@@ -588,7 +588,6 @@ void do_free(znode *op1 CLS_DC)
&& opline->result.u.var == op1->u.var) {
opline->result.u.EA.type |= EXT_TYPE_UNUSED;
} else {
-
/* This should be an object instanciation
* Find JMP_NO_CTOR, mark the preceding ASSIGN and the
* proceeding INIT_FCALL_BY_NAME as unused
@@ -833,10 +832,28 @@ void do_pass_param(znode *param, int op, int offset CLS_DC)
}
-void do_return(znode *expr CLS_DC)
+static void generate_free_switch_expr(zend_switch_entry *switch_entry CLS_DC)
{
zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
+ opline->opcode = ZEND_SWITCH_FREE;
+ opline->op1 = switch_entry->cond;
+ SET_UNUSED(opline->op2);
+}
+
+
+void do_return(znode *expr CLS_DC)
+{
+ zend_op *opline;
+
+#ifdef ZTS
+ zend_stack_apply_with_argument(&CG(switch_cond_stack), (void (*)(void *element, void *)) generate_free_switch_expr, ZEND_STACK_APPLY_TOPDOWN CLS_CC);
+#else
+ zend_stack_apply(&CG(switch_cond_stack), (void (*)(void *element)) generate_free_switch_expr, ZEND_STACK_APPLY_TOPDOWN);
+#endif
+
+ opline = get_next_op(CG(active_op_array) CLS_CC);
+
opline->opcode = ZEND_RETURN;
if (expr) {
opline->op1 = *expr;
@@ -1096,7 +1113,10 @@ void do_switch_end(znode *case_list CLS_DC)
CG(active_op_array)->current_brk_cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].parent;
/* emit free for the switch condition*/
- do_free(&switch_entry_ptr->cond CLS_CC);
+ opline = get_next_op(CG(active_op_array) CLS_CC);
+ opline->opcode = ZEND_SWITCH_FREE;
+ opline->op1 = switch_entry_ptr->cond;
+ SET_UNUSED(opline->op2);
if (switch_entry_ptr->cond.op_type == IS_CONST) {
zval_dtor(&switch_entry_ptr->cond.u.constant);
}
View
@@ -418,8 +418,8 @@ int zendlex(znode *zendlval CLS_DC);
#define ZEND_ASSIGN 36
#define ZEND_ASSIGN_REF 37
-#define ZEND_ECHO 38
-#define ZEND_PRINT 39
+#define ZEND_ECHO 38
+#define ZEND_PRINT 39
#define ZEND_JMP 40
#define ZEND_JMPZ 41
@@ -428,74 +428,75 @@ int zendlex(znode *zendlval CLS_DC);
#define ZEND_JMPZ_EX 44
#define ZEND_JMPNZ_EX 45
#define ZEND_CASE 46
-#define ZEND_BRK 47
-#define ZEND_CONT 48
-#define ZEND_BOOL 49
-
-#define ZEND_INIT_STRING 50
-#define ZEND_ADD_CHAR 51
-#define ZEND_ADD_STRING 52
-#define ZEND_ADD_VAR 53
-
-#define ZEND_BEGIN_SILENCE 54
-#define ZEND_END_SILENCE 55
-
-#define ZEND_INIT_FCALL_BY_NAME 56
-#define ZEND_DO_FCALL 57
-#define ZEND_DO_FCALL_BY_NAME 58
-#define ZEND_RETURN 59
-
-#define ZEND_RECV 60
-#define ZEND_RECV_INIT 61
+#define ZEND_SWITCH_FREE 47
+#define ZEND_BRK 48
+#define ZEND_CONT 49
+#define ZEND_BOOL 50
+
+#define ZEND_INIT_STRING 51
+#define ZEND_ADD_CHAR 52
+#define ZEND_ADD_STRING 53
+#define ZEND_ADD_VAR 54
+
+#define ZEND_BEGIN_SILENCE 55
+#define ZEND_END_SILENCE 56
+
+#define ZEND_INIT_FCALL_BY_NAME 57
+#define ZEND_DO_FCALL 58
+#define ZEND_DO_FCALL_BY_NAME 59
+#define ZEND_RETURN 60
+
+#define ZEND_RECV 61
+#define ZEND_RECV_INIT 62
-#define ZEND_SEND_VAL 62
-#define ZEND_SEND_VAR 63
-#define ZEND_SEND_REF 64
+#define ZEND_SEND_VAL 63
+#define ZEND_SEND_VAR 64
+#define ZEND_SEND_REF 65
-#define ZEND_NEW 65
-#define ZEND_JMP_NO_CTOR 66
-#define ZEND_FREE 67
+#define ZEND_NEW 66
+#define ZEND_JMP_NO_CTOR 67
+#define ZEND_FREE 68
-#define ZEND_INIT_ARRAY 68
-#define ZEND_ADD_ARRAY_ELEMENT 69
+#define ZEND_INIT_ARRAY 69
+#define ZEND_ADD_ARRAY_ELEMENT 70
-#define ZEND_INCLUDE_OR_EVAL 70
+#define ZEND_INCLUDE_OR_EVAL 71
-#define ZEND_UNSET_VAR 71
-#define ZEND_UNSET_DIM_OBJ 72
-#define ZEND_ISSET_ISEMPTY 73
+#define ZEND_UNSET_VAR 72
+#define ZEND_UNSET_DIM_OBJ 73
+#define ZEND_ISSET_ISEMPTY 74
-#define ZEND_FE_RESET 74
-#define ZEND_FE_FETCH 75
+#define ZEND_FE_RESET 75
+#define ZEND_FE_FETCH 76
-#define ZEND_EXIT 76
+#define ZEND_EXIT 77
/* the following 12 opcodes are 4 groups of 3 opcodes each, and must
* remain in that order!
*/
-#define ZEND_FETCH_R 77
-#define ZEND_FETCH_DIM_R 78
-#define ZEND_FETCH_OBJ_R 79
-#define ZEND_FETCH_W 80
-#define ZEND_FETCH_DIM_W 81
-#define ZEND_FETCH_OBJ_W 82
-#define ZEND_FETCH_RW 83
-#define ZEND_FETCH_DIM_RW 84
-#define ZEND_FETCH_OBJ_RW 85
-#define ZEND_FETCH_IS 86
-#define ZEND_FETCH_DIM_IS 87
-#define ZEND_FETCH_OBJ_IS 88
-
-#define ZEND_FETCH_DIM_TMP_VAR 89
-#define ZEND_FETCH_CONSTANT 90
-
-#define ZEND_DECLARE_FUNCTION_OR_CLASS 91
-
-#define ZEND_EXT_STMT 92
-#define ZEND_EXT_FCALL_BEGIN 93
-#define ZEND_EXT_FCALL_END 94
-#define ZEND_EXT_NOP 95
+#define ZEND_FETCH_R 78
+#define ZEND_FETCH_DIM_R 79
+#define ZEND_FETCH_OBJ_R 80
+#define ZEND_FETCH_W 81
+#define ZEND_FETCH_DIM_W 82
+#define ZEND_FETCH_OBJ_W 83
+#define ZEND_FETCH_RW 84
+#define ZEND_FETCH_DIM_RW 85
+#define ZEND_FETCH_OBJ_RW 86
+#define ZEND_FETCH_IS 87
+#define ZEND_FETCH_DIM_IS 88
+#define ZEND_FETCH_OBJ_IS 89
+
+#define ZEND_FETCH_DIM_TMP_VAR 90
+#define ZEND_FETCH_CONSTANT 91
+
+#define ZEND_DECLARE_FUNCTION_OR_CLASS 92
+
+#define ZEND_EXT_STMT 93
+#define ZEND_EXT_FCALL_BEGIN 94
+#define ZEND_EXT_FCALL_END 95
+#define ZEND_EXT_NOP 96
/* end of block */
View
@@ -1592,14 +1592,45 @@ binary_assign_op_addr: {
continue;
}
break;
- case ZEND_CASE:
- if (opline->op1.op_type == IS_VAR) {
- PZVAL_LOCK(*Ts[opline->op1.u.var].var);
+ case ZEND_CASE: {
+ int switch_expr_is_overloaded=0;
+
+ if (opline->op1.op_type==IS_VAR) {
+ if (Ts[opline->op1.u.var].var) {
+ PZVAL_LOCK(*Ts[opline->op1.u.var].var);
+ } else {
+ switch_expr_is_overloaded = 1;
+ if (Ts[opline->op1.u.var].EA.type==IS_STRING_OFFSET) {
+ Ts[opline->op1.u.var].EA.str->refcount++;
+ }
+ }
+ }
+ is_equal_function(&Ts[opline->result.u.var].tmp_var,
+ get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R),
+ get_zval_ptr(&opline->op2, Ts, &free_op2, BP_VAR_R));
+
+ FREE_OP(&opline->op2, free_op2);
+ if (switch_expr_is_overloaded) {
+ /* We only free op1 if this is a string offset,
+ * Since if it is a TMP_VAR, it'll be reused by
+ * other CASE opcodes (whereas string offsets
+ * are allocated at each get_zval_ptr())
+ */
+ FREE_OP(&opline->op1, free_op1);
+ Ts[opline->op1.u.var].var = NULL;
+ }
+ }
+ break;
+ case ZEND_SWITCH_FREE:
+ switch (opline->op1.op_type) {
+ case IS_VAR:
+ get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R);
+ FREE_OP(&opline->op1, free_op1);
+ break;
+ case IS_TMP_VAR:
+ zendi_zval_dtor(Ts[opline->op1.u.var].tmp_var);
+ break;
}
- is_equal_function(&Ts[opline->result.u.var].tmp_var,
- get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R),
- get_zval_ptr(&opline->op2, Ts, &free_op2, BP_VAR_R) );
- FREE_OP(&opline->op2, free_op2);
break;
case ZEND_NEW: {
zval *tmp = get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R);
View
@@ -28,7 +28,7 @@ typedef union _temp_variable {
zval tmp_var;
zval **var;
struct {
- zval **var_dummy; /* a dummy */
+ zval tmp_var; /* a dummy */
zval *str;
int offset;
View
@@ -162,34 +162,29 @@ ZEND_API void convert_to_long_base(zval *op, int base)
case IS_BOOL:
case IS_RESOURCE:
case IS_LONG:
- return;
+ break;
case IS_DOUBLE:
op->value.lval = (long) op->value.dval;
- op->type = IS_LONG;
break;
case IS_STRING:
strval = op->value.str.val;
op->value.lval = strtol(strval, NULL, base);
- op->type = IS_LONG;
STR_FREE(strval);
break;
case IS_ARRAY:
tmp = (zend_hash_num_elements(op->value.ht)?1:0);
zval_dtor(op);
op->value.lval = tmp;
- op->type = IS_LONG;
break;
case IS_OBJECT:
tmp = (zend_hash_num_elements(op->value.obj.properties)?1:0);
zval_dtor(op);
op->value.lval = tmp;
- op->type = IS_LONG;
break;
default:
zend_error(E_WARNING, "Cannot convert to ordinal value");
zval_dtor(op);
op->value.lval = 0;
- op->type = IS_LONG;
break;
}
View
@@ -116,3 +116,41 @@ ZEND_API int zend_stack_count(zend_stack *stack)
{
return stack->top;
}
+
+
+ZEND_API void zend_stack_apply(zend_stack *stack, void (*apply_function)(void *element), int type)
+{
+ int i;
+
+ switch (type) {
+ case ZEND_STACK_APPLY_TOPDOWN:
+ for (i=stack->top-1; i>=0; i--) {
+ apply_function(stack->elements[i]);
+ }
+ break;
+ case ZEND_STACK_APPLY_BOTTOMUP:
+ for (i=0; i<stack->top; i++) {
+ apply_function(stack->elements[i]);
+ }
+ break;
+ }
+}
+
+
+ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, void (*apply_function)(void *element, void *arg), int type, void *arg)
+{
+ int i;
+
+ switch (type) {
+ case ZEND_STACK_APPLY_TOPDOWN:
+ for (i=stack->top-1; i>=0; i--) {
+ apply_function(stack->elements[i], arg);
+ }
+ break;
+ case ZEND_STACK_APPLY_BOTTOMUP:
+ for (i=0; i<stack->top; i++) {
+ apply_function(stack->elements[i], arg);
+ }
+ break;
+ }
+}
Oops, something went wrong.

0 comments on commit 5bfa702

Please sign in to comment.