php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch fix-0.4.1-PHP_OPERATOR_OPHANDLER_COUNT for operator Bug #64278

Patch version 2013-02-25 03:58 UTC

Return to Bug #64278 | Download this patch
Patch Revisions:

Developer: ku@digitaldolphins.jp

 operator.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/operator.c b/operator.c
index f5fe1da..32da709 100644
--- a/operator.c
+++ b/operator.c
@@ -56,7 +56,7 @@ static inline int php_operator_method(zval *result, zval *op1, const char *metho
 	#else
 		ZVAL_ADDREF(op1);
 	#endif
-int i;
+
 	add_index_zval(caller, 0, op1);
 	add_index_stringl(caller, 1, (char*)method, method_len, 1);
 
@@ -270,7 +270,18 @@ static inline int _php_operator_decode(zend_op *opline)
 #endif
 	return ret;
 }
-#define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 151) + 1)
+#if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 5)
+# error "Operator overload support requires newer PHP_OPERATOR_OPHANDLER_COUNT"
+#elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 5)
+# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 164) + 1)
+#elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 4)
+# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 159) + 1)
+#elif (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3)
+# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 154) + 1)
+#else
+# define PHP_OPERATOR_OPHANDLER_COUNT				((25 * 151) + 1)
+#endif
+
 #define PHP_OPERATOR_REPLACE_OPCODE(opname)			{ int i; for(i = 5; i < 25; i++) if (php_operator_opcode_handlers[(opname*25) + i]) php_operator_opcode_handlers[(opname*25) + i] = php_operator_op_##opname; }
 #define PHP_OPERATOR_REPLACE_ALL_OPCODE(opname)		{ int i; for(i = 0; i < 25; i++) if (php_operator_opcode_handlers[(opname*25) + i]) php_operator_opcode_handlers[(opname*25) + i] = php_operator_op_##opname; }
 #define PHP_OPERATOR_DECODE(opline)					_php_operator_decode(opline)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC