summaryrefslogtreecommitdiff
path: root/Zend/zend_vm_execute.h
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_vm_execute.h')
-rw-r--r--Zend/zend_vm_execute.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 59dd5080a5..8a0ef5b04b 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -14035,10 +14035,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {
@@ -15941,10 +15948,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {
@@ -18205,10 +18219,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {
@@ -21119,10 +21140,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {
@@ -22446,10 +22474,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {
@@ -23596,10 +23631,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {
@@ -24746,10 +24788,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {
@@ -26162,10 +26211,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {
@@ -29470,10 +29526,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {
@@ -31250,10 +31313,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {
@@ -33387,10 +33457,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {
@@ -36038,10 +36115,17 @@ num_index_prop:
zval tmp;
if (Z_TYPE_P(offset) != IS_LONG) {
+ if (Z_TYPE_P(offset) <= IS_BOOL /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1))) {
ZVAL_COPY_VALUE(&tmp, offset);
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
offset = &tmp;
+ } else {
+ /* can not be converted to proper offset, return "not set" */
+ result = 0;
+ }
}
if (Z_TYPE_P(offset) == IS_LONG) {
if (opline->extended_value & ZEND_ISSET) {