summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/tests/bw_or_assign_with_ref.phpt14
-rw-r--r--Zend/tests/double_array_cast.phpt18
-rw-r--r--Zend/tests/object_array_cast.phpt47
-rw-r--r--Zend/zend_execute.c4
-rw-r--r--Zend/zend_generators.c4
-rw-r--r--Zend/zend_indent.c6
-rw-r--r--Zend/zend_vm_def.h25
-rw-r--r--Zend/zend_vm_execute.h136
-rw-r--r--ext/mysqli/mysqli_api.c2
-rw-r--r--ext/xmlrpc/libxmlrpc/encodings.c1
-rw-r--r--sapi/cgi/cgi_main.c7
-rw-r--r--sapi/cli/php_cli.c10
-rw-r--r--sapi/cli/php_cli_server.c40
13 files changed, 197 insertions, 117 deletions
diff --git a/Zend/tests/bw_or_assign_with_ref.phpt b/Zend/tests/bw_or_assign_with_ref.phpt
new file mode 100644
index 0000000000..27ccf6299b
--- /dev/null
+++ b/Zend/tests/bw_or_assign_with_ref.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bitwise or assign with referenced value
+--FILE--
+<?php
+
+$num1 = 1;
+$num2 = '2';
+$ref =& $num2;
+$num1 |= $num2;
+var_dump($num1);
+
+?>
+--EXPECT--
+int(3)
diff --git a/Zend/tests/double_array_cast.phpt b/Zend/tests/double_array_cast.phpt
new file mode 100644
index 0000000000..aaee8cd919
--- /dev/null
+++ b/Zend/tests/double_array_cast.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Double array cast
+--FILE--
+<?php
+
+$array = [1, 2, $x = 3];
+var_dump((array) (array) $array);
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
diff --git a/Zend/tests/object_array_cast.phpt b/Zend/tests/object_array_cast.phpt
new file mode 100644
index 0000000000..1cf3dbbd9c
--- /dev/null
+++ b/Zend/tests/object_array_cast.phpt
@@ -0,0 +1,47 @@
+--TEST--
+(object) (array) and (array) (object) casts
+--FILE--
+<?php
+
+$arr = [1, 2, 3];
+var_dump((object) (array) $arr);
+var_dump($arr);
+
+$obj = (object) [1, 2, 3];
+var_dump((array) (object) $obj);
+var_dump($obj);
+
+?>
+--EXPECT--
+object(stdClass)#1 (3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+object(stdClass)#1 (3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index a3f18b960f..58038c94a4 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1522,7 +1522,7 @@ static zend_always_inline void i_init_func_execute_data(zend_execute_data *execu
}
/* Initialize CV variables (skip arguments) */
- if (EXPECTED(num_args < op_array->last_var)) {
+ if (EXPECTED((int)num_args < op_array->last_var)) {
zval *var = EX_VAR_NUM(num_args);
zval *end = EX_VAR_NUM(op_array->last_var);
@@ -1621,7 +1621,7 @@ static zend_always_inline void i_init_execute_data(zend_execute_data *execute_da
}
/* Initialize CV variables (skip arguments) */
- if (EXPECTED(num_args < op_array->last_var)) {
+ if (EXPECTED((int)num_args < op_array->last_var)) {
zval *var = EX_VAR_NUM(num_args);
zval *end = EX_VAR_NUM(op_array->last_var);
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index c0d087fd99..b38657f7b7 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -52,9 +52,9 @@ static void zend_generator_cleanup_unfinished_execution(zend_generator *generato
if (brk_cont->start < 0) {
continue;
- } else if (brk_cont->start > op_num) {
+ } else if ((uint32_t)brk_cont->start > op_num) {
break;
- } else if (brk_cont->brk > op_num) {
+ } else if (brk_cont->brk >= 0 && (uint32_t)brk_cont->brk > op_num) {
zend_op *brk_opline = op_array->opcodes + brk_cont->brk;
if (brk_opline->opcode == ZEND_FREE) {
diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c
index 5ebc4527e2..93c10108f8 100644
--- a/Zend/zend_indent.c
+++ b/Zend/zend_indent.c
@@ -52,9 +52,9 @@ ZEND_API void zend_indent(TSRMLS_D)
zval token;
int token_type;
int in_string=0;
- int nest_level=0;
- int emit_whitespace[256];
- int i;
+ unsigned int nest_level=0;
+ unsigned int emit_whitespace[256];
+ unsigned int i;
memset(emit_whitespace, 0, sizeof(int)*256);
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 091b384c33..af532e88e4 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -343,7 +343,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -444,7 +444,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_dim_helper, VAR|UNUSED|CV, CONST|TMP|VAR
zval *dim = GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, OP2_TYPE TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -497,7 +497,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|UNUSED|CV, CONST|TMP|VAR|UNU
zval *value;
SAVE_OPLINE();
- value = GET_OP2_ZVAL_PTR(BP_VAR_R);
+ value = GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R);
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
if (OP1_TYPE == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
@@ -4043,7 +4043,7 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
- FREE_OP1();
+ FREE_OP1_IF_VAR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4058,15 +4058,13 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (OP1_TYPE != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (OP1_TYPE != IS_TMP_VAR) {
- zval_opt_copy_ctor(result);
- }
+ Z_ADDREF_P(result);
convert_to_array(result);
}
} else {
@@ -4078,23 +4076,18 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (OP1_TYPE != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (OP1_TYPE != IS_TMP_VAR) {
- zval_opt_copy_ctor(result);
- }
+ zval_opt_copy_ctor(result);
convert_to_object(result);
}
}
-
- FREE_OP1_IF_VAR();
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
}
+
FREE_OP1();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 9f8be5ceb0..0768aa6df2 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -2893,15 +2893,13 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_CONST != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (IS_CONST != IS_TMP_VAR) {
- zval_opt_copy_ctor(result);
- }
+ Z_ADDREF_P(result);
convert_to_array(result);
}
} else {
@@ -2913,21 +2911,16 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_CONST != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (IS_CONST != IS_TMP_VAR) {
- zval_opt_copy_ctor(result);
- }
+ zval_opt_copy_ctor(result);
convert_to_object(result);
}
}
-
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
}
CHECK_EXCEPTION();
@@ -9695,7 +9688,6 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
- zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -9710,15 +9702,13 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_TMP_VAR != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (IS_TMP_VAR != IS_TMP_VAR) {
- zval_opt_copy_ctor(result);
- }
+ Z_ADDREF_P(result);
convert_to_array(result);
}
} else {
@@ -9730,22 +9720,18 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_TMP_VAR != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (IS_TMP_VAR != IS_TMP_VAR) {
- zval_opt_copy_ctor(result);
- }
+ zval_opt_copy_ctor(result);
convert_to_object(result);
}
}
-
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
}
+
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -16431,15 +16417,13 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_VAR != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (IS_VAR != IS_TMP_VAR) {
- zval_opt_copy_ctor(result);
- }
+ Z_ADDREF_P(result);
convert_to_array(result);
}
} else {
@@ -16451,23 +16435,18 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_VAR != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (IS_VAR != IS_TMP_VAR) {
- zval_opt_copy_ctor(result);
- }
+ zval_opt_copy_ctor(result);
convert_to_object(result);
}
}
-
- zval_ptr_dtor_nogc(free_op1.var);
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
}
+
zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
@@ -17543,7 +17522,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -17643,7 +17622,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_CONST(int (*b
zval *dim = opline->op2.zv;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CONST TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -19980,7 +19959,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -20081,7 +20060,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_TMP(int (*bin
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_TMP_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -21992,7 +21971,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -22093,7 +22072,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_VAR(int (*bin
zval *dim = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -22146,7 +22125,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_VAR(int (*binary_
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ value = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
@@ -24098,7 +24077,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -24198,7 +24177,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_UNUSED(int (*
zval *dim = NULL;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_UNUSED TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -25571,7 +25550,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -25671,7 +25650,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_VAR_CV(int (*bina
zval *dim = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CV TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -25724,7 +25703,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_VAR_CV(int (*binary_o
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if (IS_VAR == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
@@ -27441,7 +27420,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -27540,7 +27519,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_CONST(int
zval *dim = opline->op2.zv;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CONST TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -28831,7 +28810,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -28931,7 +28910,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_TMP(int (*
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_TMP_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -30139,7 +30118,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -30239,7 +30218,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_VAR(int (*
zval *dim = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -30292,7 +30271,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_VAR(int (*bina
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ value = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
var_ptr = NULL;
if (IS_UNUSED == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
@@ -31447,7 +31426,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -31546,7 +31525,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_UNUSED(int
zval *dim = NULL;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_UNUSED TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -31966,7 +31945,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -32065,7 +32044,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_UNUSED_CV(int (*b
zval *dim = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CV TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -32118,7 +32097,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_UNUSED_CV(int (*binar
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
var_ptr = NULL;
if (IS_UNUSED == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
@@ -34080,15 +34059,13 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_CV != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (IS_CV != IS_TMP_VAR) {
- zval_opt_copy_ctor(result);
- }
+ Z_ADDREF_P(result);
convert_to_array(result);
}
} else {
@@ -34100,21 +34077,16 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
zval_copy_ctor_func(expr);
}
- } else if (IS_CV != IS_TMP_VAR) {
+ } else {
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
}
} else {
ZVAL_COPY_VALUE(result, expr);
- if (IS_CV != IS_TMP_VAR) {
- zval_opt_copy_ctor(result);
- }
+ zval_opt_copy_ctor(result);
convert_to_object(result);
}
}
-
- CHECK_EXCEPTION();
- ZEND_VM_NEXT_OPCODE();
}
CHECK_EXCEPTION();
@@ -34947,7 +34919,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -35046,7 +35018,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_CONST(int (*bi
zval *dim = opline->op2.zv;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CONST TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -37217,7 +37189,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -37317,7 +37289,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_TMP(int (*bina
zval *dim = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_TMP_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -39101,7 +39073,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -39201,7 +39173,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_VAR(int (*bina
zval *dim = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_VAR TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -39254,7 +39226,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_VAR(int (*binary_o
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
+ value = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
@@ -41078,7 +41050,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -41177,7 +41149,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_UNUSED(int (*b
zval *dim = NULL;
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_UNUSED TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -42407,7 +42379,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
object = make_real_object(object TSRMLS_CC);
}
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
zend_error(E_WARNING, "Attempt to assign property of non-object");
@@ -42506,7 +42478,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_dim_helper_SPEC_CV_CV(int (*binar
zval *dim = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
zend_fetch_dimension_address_RW(EX_VAR((opline+1)->op2.var), container, dim, IS_CV TSRMLS_CC);
- value = get_zval_ptr((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
+ value = get_zval_ptr_deref((opline+1)->op1_type, &(opline+1)->op1, execute_data, &free_op_data1, BP_VAR_R);
var_ptr = _get_zval_ptr_ptr_var((opline+1)->op2.var, execute_data, &free_op_data2 TSRMLS_CC);
}
@@ -42559,7 +42531,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_helper_SPEC_CV_CV(int (*binary_op
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
+ value = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(execute_data, opline->op1.var TSRMLS_CC);
if (IS_CV == IS_VAR && UNEXPECTED(var_ptr == NULL)) {
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 4eff098999..69799729b7 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -791,7 +791,7 @@ PHP_FUNCTION(mysqli_data_seek)
RETURN_FALSE;
}
- if (offset < 0 || offset >= mysql_num_rows(result)) {
+ if (offset < 0 || (uint64_t)offset >= mysql_num_rows(result)) {
RETURN_FALSE;
}
diff --git a/ext/xmlrpc/libxmlrpc/encodings.c b/ext/xmlrpc/libxmlrpc/encodings.c
index f4cc212d7c..467dca922e 100644
--- a/ext/xmlrpc/libxmlrpc/encodings.c
+++ b/ext/xmlrpc/libxmlrpc/encodings.c
@@ -44,6 +44,7 @@
static const char rcsid[] = "#(@) $Id$";
#include <errno.h>
+#include <string.h>
#ifdef HAVE_GICONV_H
#include <giconv.h>
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index dead1c3213..f06787543e 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -509,8 +509,13 @@ static size_t sapi_cgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC)
{
size_t read_bytes = 0;
int tmp_read_bytes;
+ size_t remaining_bytes;
- count_bytes = MIN(count_bytes, SG(request_info).content_length - SG(read_post_bytes));
+ assert(SG(request_info).content_length >= SG(read_post_bytes));
+
+ remaining_bytes = (size_t)(SG(request_info).content_length - SG(read_post_bytes));
+
+ count_bytes = MIN(count_bytes, remaining_bytes);
while (read_bytes < count_bytes) {
tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes);
if (tmp_read_bytes <= 0) {
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 19e56284e3..7513b72504 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -244,7 +244,7 @@ static inline int sapi_cli_select(int fd TSRMLS_DC)
PHP_SAFE_FD_SET(fd, &wfd);
- tv.tv_sec = FG(default_socket_timeout);
+ tv.tv_sec = (long)FG(default_socket_timeout);
tv.tv_usec = 0;
ret = php_select(fd+1, &dfd, &wfd, &dfd, &tv);
@@ -1120,7 +1120,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */
}
case PHP_MODE_REFLECTION_EXT_INFO:
{
- int len = strlen(reflection_what);
+ int len = (int)strlen(reflection_what);
char *lcname = zend_str_tolower_dup(reflection_what, len);
zend_module_entry *module;
@@ -1258,7 +1258,7 @@ int main(int argc, char *argv[])
break;
case 'd': {
/* define ini entries on command line */
- int len = strlen(php_optarg);
+ int len = (int)strlen(php_optarg);
char *val;
if ((val = strchr(php_optarg, '='))) {
@@ -1266,11 +1266,11 @@ int main(int argc, char *argv[])
if (!isalnum(*val) && *val != '"' && *val != '\'' && *val != '\0') {
ini_entries = realloc(ini_entries, ini_entries_len + len + sizeof("\"\"\n\0"));
memcpy(ini_entries + ini_entries_len, php_optarg, (val - php_optarg));
- ini_entries_len += (val - php_optarg);
+ ini_entries_len += (int)(val - php_optarg);
memcpy(ini_entries + ini_entries_len, "\"", 1);
ini_entries_len++;
memcpy(ini_entries + ini_entries_len, val, len - (val - php_optarg));
- ini_entries_len += len - (val - php_optarg);
+ ini_entries_len += len - (int)(val - php_optarg);
memcpy(ini_entries + ini_entries_len, "\"\n\0", sizeof("\"\n\0"));
ini_entries_len += sizeof("\n\0\"") - 2;
} else {
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 04a82e812d..3936e25335 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -453,7 +453,7 @@ static void add_response_header(sapi_header_struct *h, zval *return_value TSRMLS
do {
p++;
} while (*p == ' ' || *p == '\t');
- add_assoc_stringl_ex(return_value, s, len, p, h->header_len - (p - h->header));
+ add_assoc_stringl_ex(return_value, s, (uint)len, p, h->header_len - (p - h->header));
free_alloca(s, use_heap);
}
}
@@ -1027,12 +1027,20 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen
size_t _nbytes_sent_total = 0;
for (chunk = sender->buffer.first; chunk; chunk = next) {
+#ifdef PHP_WIN32
+ int nbytes_sent;
+#else
ssize_t nbytes_sent;
+#endif
next = chunk->next;
switch (chunk->type) {
case PHP_CLI_SERVER_CHUNK_HEAP:
+#ifdef PHP_WIN32
+ nbytes_sent = send(fd, chunk->data.heap.p, (int)chunk->data.heap.len, 0);
+#else
nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0);
+#endif
if (nbytes_sent < 0) {
*nbytes_sent_total = _nbytes_sent_total;
return php_socket_errno();
@@ -1051,7 +1059,11 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen
break;
case PHP_CLI_SERVER_CHUNK_IMMORTAL:
+#ifdef PHP_WIN32
+ nbytes_sent = send(fd, chunk->data.immortal.p, (int)chunk->data.immortal.len, 0);
+#else
nbytes_sent = send(fd, chunk->data.immortal.p, chunk->data.immortal.len, 0);
+#endif
if (nbytes_sent < 0) {
*nbytes_sent_total = _nbytes_sent_total;
return php_socket_errno();
@@ -1076,10 +1088,18 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen
static int php_cli_server_content_sender_pull(php_cli_server_content_sender *sender, int fd, size_t *nbytes_read TSRMLS_DC) /* {{{ */
{
+#ifdef PHP_WIN32
+ int _nbytes_read;
+#else
ssize_t _nbytes_read;
+#endif
php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(131072);
+#ifdef PHP_WIN32
+ _nbytes_read = read(fd, chunk->data.heap.p, (unsigned int)chunk->data.heap.len);
+#else
_nbytes_read = read(fd, chunk->data.heap.p, chunk->data.heap.len);
+#endif
if (_nbytes_read < 0) {
char *errstr = get_last_error();
php_cli_server_logf("%s" TSRMLS_CC, errstr);
@@ -1204,7 +1224,7 @@ static void php_cli_server_logf(const char *format TSRMLS_DC, ...) /* {{{ */
efree(buf);
} /* }}} */
-static int php_network_listen_socket(const char *host, int *port, int socktype, int *af, socklen_t *socklen, zend_string **errstr TSRMLS_DC) /* {{{ */
+static php_socket_t php_network_listen_socket(const char *host, int *port, int socktype, int *af, socklen_t *socklen, zend_string **errstr TSRMLS_DC) /* {{{ */
{
php_socket_t retval = SOCK_ERR;
int err = 0;
@@ -1493,7 +1513,7 @@ static void normalize_vpath(char **retval, size_t *retval_len, const char *vpath
return;
}
- decoded_vpath_end = decoded_vpath + php_url_decode(decoded_vpath, vpath_len);
+ decoded_vpath_end = decoded_vpath + php_url_decode(decoded_vpath, (int)vpath_len);
p = decoded_vpath;
@@ -1733,9 +1753,19 @@ static int php_cli_server_client_read_request(php_cli_server_client *client, cha
static size_t php_cli_server_client_send_through(php_cli_server_client *client, const char *str, size_t str_len) /* {{{ */
{
struct timeval tv = { 10, 0 };
- ssize_t nbytes_left = str_len;
+#ifdef PHP_WIN32
+ int nbytes_left = (int)str_len;
+#else
+ ssize_t nbytes_left = (ssize_t)str_len;
+#endif
do {
- ssize_t nbytes_sent = send(client->sock, str + str_len - nbytes_left, nbytes_left, 0);
+#ifdef PHP_WIN32
+ int nbytes_sent;
+#else
+ ssize_t nbytes_sent;
+#endif
+
+ nbytes_sent = send(client->sock, str + str_len - nbytes_left, nbytes_left, 0);
if (nbytes_sent < 0) {
int err = php_socket_errno();
if (err == SOCK_EAGAIN) {