php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | |
Patch fix_disabling_bad_string_offsets for Arrays related Bug #60362Patch version 2011-12-04 16:43 UTC Return to Bug #60362 | Download this patchThis patch renders other patches obsolete Obsolete patches: Patch Revisions: 2011-12-04 16:43 UTC | 2011-12-04 12:44 UTCDeveloper: laruence@php.netLine 1 (now 1), was 71 lines, now 36 lines Index: Zend/zend_execute.c =================================================================== --- Zend/zend_execute.c (revision 320308) --- Zend/zend_execute.c (revision 320369) +++ Zend/zend_execute.c (working copy) @@ -998,7 +998,7 @@ char *offset_key; int offset_key_length; ulong hval; - + switch (dim->type) { case IS_NULL: offset_key = ""; @@ -1014,6 +1014,7 @@ if (dim_type == IS_CONST) { hval = Z_HASH_P(dim); } else { + ZEND_HANDLE_NUMERIC_EX(offset_key, offset_key_length+1, hval, goto num_index); if (IS_INTERNED(offset_key)) { hval = INTERNED_HASH(offset_key); @@ -1089,7 +1090,6 @@ { zval *container = *container_ptr; zval **retval; - switch (Z_TYPE_P(container)) { case IS_ARRAY: @@ -1138,7 +1138,7 @@ case IS_STRING: { zval tmp; - + if (type != BP_VAR_UNSET && Z_STRLEN_P(container)==0) { goto convert_to_array; } @@ -1147,15 +1147,27 @@ @@ -1147,15 +1147,25 @@ } if (Z_TYPE_P(dim) != IS_LONG) { + int invalid_string = 0; switch(Z_TYPE_P(dim)) { /* case IS_LONG: */ case IS_STRING: switch(Z_TYPE_P(dim)) { /* case IS_LONG: */ case IS_STRING: + if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) { + break; + } + } + if (type != BP_VAR_UNSET) { + zend_error(E_WARNING, "Invalid string offset '%s'", dim->value.str.val); + } + invalid_string = 1; + zend_error(E_WARNING, "Invalid string offset '%s'", dim->value.str.val); + } + invalid_string = 1; + break; + case IS_DOUBLE: case IS_NULL: case IS_BOOL: - /* do nothing */ + zend_error(E_NOTICE, "String offset cast occured"); /* do nothing */ break; break; default: + invalid_string = 1; zend_error(E_WARNING, "Illegal offset type"); break; } @@ -1164,6 +1176,9 @@ @@ -1164,6 +1174,9 @@ zval_copy_ctor(&tmp); convert_to_long(&tmp); dim = &tmp; + if (invalid_string) { Line 73 (now 38), was 17 lines, now 9 lines + } } if (type != BP_VAR_UNSET) { SEPARATE_ZVAL_IF_NOT_REF(container_ptr); @@ -1243,7 +1258,6 @@ { zval *container = *container_ptr; zval **retval; - switch (Z_TYPE_P(container)) { case IS_ARRAY: @@ -1260,17 +1274,27 @@ @@ -1260,17 +1273,27 @@ case IS_STRING: { zval tmp; zval *ptr; - Line 95 (now 52), was 16 lines, now 15 lines case IS_STRING: + if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) { + break; + } + invalid_string = 1; + if (type != BP_VAR_IS) { + zend_error(E_WARNING, "Illegal string offset '%s'", dim->value.str.val); + } + invalid_string = 1; + break; case IS_DOUBLE: - case IS_NULL: + case IS_NULL: case IS_NULL: case IS_BOOL: - /* do nothing */ + zend_error(E_NOTICE, "String offset cast occured"); break; + invalid_string = 1; zend_error(E_WARNING, "Illegal offset type"); break; } @@ -1279,6 +1303,9 @@ @@ -1279,6 +1302,9 @@ zval_copy_ctor(&tmp); convert_to_long(&tmp); dim = &tmp; + if (invalid_string) { + } } ALLOC_ZVAL(ptr); @@ -1286,8 +1313,8 @@ @@ -1286,8 +1312,8 @@ Z_TYPE_P(ptr) = IS_STRING; if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) { - if (type != BP_VAR_IS) { Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC(); Z_STRLEN_P(ptr) = 0; Index: Zend/tests/offset_string.phpt =================================================================== --- Zend/tests/offset_string.phpt (revision 320308) --- Zend/tests/offset_string.phpt (revision 320369) +++ Zend/tests/offset_string.phpt (working copy) @@ -24,22 +24,32 @@ echo "Done\n"; +Done \ No newline at end of file Index: Zend/tests/bug39304.phpt =================================================================== --- Zend/tests/bug39304.phpt (revision 320308) --- Zend/tests/bug39304.phpt (revision 320369) +++ Zend/tests/bug39304.phpt (working copy) @@ -7,10 +7,10 @@ echo "I am alive"; ?> I am alive Index: Zend/tests/bug39304_2_4.phpt =================================================================== --- Zend/tests/bug39304_2_4.phpt (revision 320308) --- Zend/tests/bug39304_2_4.phpt (revision 320369) +++ Zend/tests/bug39304_2_4.phpt (working copy) @@ -9,10 +9,10 @@ var_dump($a,$b); ?> string(0) "" string(0) "" Index: Zend/tests/bug39018.phpt =================================================================== --- Zend/tests/bug39018.phpt (revision 320308) --- Zend/tests/bug39018.phpt (revision 320369) +++ Zend/tests/bug39018.phpt (working copy) @@ -63,30 +63,42 @@ ?> --EXPECTF-- b Done Index: Zend/tests/result_unused.phpt =================================================================== --- Zend/tests/result_unused.phpt (revision 320308) --- Zend/tests/result_unused.phpt (revision 320369) +++ Zend/tests/result_unused.phpt (working copy) @@ -24,6 +24,6 @@ $x->y; echo "ok\n"; ok Index: Zend/tests/indexing_001.phpt =================================================================== --- Zend/tests/indexing_001.phpt (revision 320308) --- Zend/tests/indexing_001.phpt (revision 320369) +++ Zend/tests/indexing_001.phpt (working copy) @@ -48,13 +48,13 @@ } } int(1) -Warning: Cannot use a scalar value as an array in %s on line %d +Warning: Cannot use a scalar value as an array in %s on line 7 bool(true) bool(true) array(1) { ["foo"]=> @@ -71,10 +71,12 @@ } } -Notice: Array to string conversion in %s on line %d -string(1) "A" +Warning: Invalid string offset 'foo' in %s on line 7 +Warning: Invalid string offset 'foo' in %s on line 7 -Warning: Cannot use a scalar value as an array in %s on line %d +Warning: Illegal string offset: -1 in %s on line 7 +string(1) " " + float(0.1) array(1) { ["foo"]=> @@ -93,13 +95,13 @@ } } } -Warning: Cannot use a scalar value as an array in %s on line %d -Warning: Cannot use a scalar value as an array in %s on line %d +Warning: Cannot use a scalar value as an array in %s on line 15 int(0) -Warning: Cannot use a scalar value as an array in %s on line %d -Warning: Cannot use a scalar value as an array in %s on line %d +Warning: Cannot use a scalar value as an array in %s on line 15 int(1) -Warning: Cannot use a scalar value as an array in %s on line %d +Warning: Cannot use a scalar value as an array in %s on line 15 +Warning: Cannot use a scalar value as an array in %s on line 15 bool(true) array(1) { ["foo"]=> @@ -116,7 +118,7 @@ float(0.1) array(1) { ["foo"]=> @@ -134,13 +136,13 @@ } } -Warning: Cannot use a scalar value as an array in %s on line %d +Warning: Cannot use a scalar value as an array in %s on line 23 int(0) } } -Warning: Cannot use a scalar value as an array in %s on line %d +Warning: Cannot use a scalar value as an array in %s on line 23 int(0) -Warning: Cannot use a scalar value as an array in %s on line %d +Warning: Cannot use a scalar value as an array in %s on line 23 int(1) +Warning: Cannot use a scalar value as an array in %s on line 31 int(1) -Warning: Cannot use a scalar value as an array in %s on line %d +Warning: Cannot use a scalar value as an array in %s on line 31 +Warning: Cannot use a scalar value as an array in %s on line 31 bool(true) array(1) { [0]=> @@ -199,7 +201,7 @@ Line 405 (now 361), was 38 lines, now 37 lines float(0.1) array(1) { [0]=> Index: Zend/tests/bug54262.phpt =================================================================== --- Zend/tests/bug54262.phpt (revision 320308) =================================================================== --- Zend/tests/bug54262.phpt (revision 320369) +++ Zend/tests/bug54262.phpt (working copy) @@ -9,7 +9,7 @@ echo "ok\n"; ?> ?> --EXPECTF-- -bool(true) +bool(false) Warning: Attempt to modify property of non-object in %sbug54262.php on line 4 Index: Zend/tests/offset_assign.phpt =================================================================== --- Zend/tests/offset_assign.phpt (revision 320308) --- Zend/tests/offset_assign.phpt (revision 320369) +++ Zend/tests/offset_assign.phpt (working copy) @@ -7,5 +7,7 @@ echo "Done\n"; ?> ---EXPECTF-- -Fatal error: Cannot use string offset as an array in %s on line %d +--EXPECTF-- +Warning: Invalid string offset 'x' in /home/alan/git/php/Zend/tests/offset_assign.php on line 3 +Warning: Invalid string offset 'x' in %soffset_assign.php on line %d + +Fatal error: Cannot use string offset as an array in /home/alan/git/php/Zend/tests/offset_assign.php on line 3 \ No newline at end of file +Fatal error: Cannot use string offset as an array in %soffset_assign.php on line %d Index: Zend/tests/str_offset_001.phpt =================================================================== --- Zend/tests/str_offset_001.phpt (revision 320308) --- Zend/tests/str_offset_001.phpt (revision 320369) +++ Zend/tests/str_offset_001.phpt (working copy) @@ -24,28 +24,28 @@ foo($str[2][1]); ?> +Notice: Uninitialized or invalid string offset: 1 in %sstr_offset_001.php on line 21 string(0) "" Index: Zend/tests/bug31098.phpt =================================================================== --- Zend/tests/bug31098.phpt (revision 320308) --- Zend/tests/bug31098.phpt (revision 320369) +++ Zend/tests/bug31098.phpt (working copy) @@ -17,25 +17,25 @@ $simpleString = "Bogus String Text"; Line 526 (now 481), was 439 lines, now 309 lines +ok \ No newline at end of file Index: Zend/zend_vm_def.h =================================================================== --- Zend/zend_vm_def.h (revision 320308) --- Zend/zend_vm_def.h (revision 320369) +++ Zend/zend_vm_def.h (working copy) @@ -4507,10 +4507,28 @@ @@ -4507,10 +4507,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { Index: Zend/zend_vm_execute.h =================================================================== --- Zend/zend_vm_execute.h (revision 320308) --- Zend/zend_vm_execute.h (revision 320369) +++ Zend/zend_vm_execute.h (working copy) @@ -14035,10 +14035,28 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -15941,10 +15959,28 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -18205,10 +18241,28 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -21119,10 +21173,28 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -22446,10 +22518,28 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -23596,10 +23686,28 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -24746,10 +24854,28 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -26162,10 +26288,28 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -29470,10 +29614,28 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -31250,10 +31412,28 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } @@ -14035,10 +14035,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -15941,10 +15949,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -18205,10 +18221,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -21119,10 +21143,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -22446,10 +22478,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -23596,10 +23636,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -24746,10 +24794,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -26162,10 +26218,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -29470,10 +29534,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -33387,10 +33567,28 @@ @@ -31250,10 +31322,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -33387,10 +33467,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { @@ -36038,10 +36236,28 @@ @@ -36038,10 +36126,18 @@ zval tmp; if (Z_TYPE_P(offset) != IS_LONG) { - ZVAL_COPY_VALUE(&tmp, offset); - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; + + if ( + ( + /** if it's an object/array etc.. */ + (Z_TYPE_P(offset) != IS_STRING) && + (Z_TYPE_P(offset) != IS_DOUBLE) && + (Z_TYPE_P(offset) != IS_NULL) && + (Z_TYPE_P(offset) != IS_BOOL) + ) || + ( + (Z_TYPE_P(offset) == IS_STRING) && + (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)) + ) + ) { + result =0; + /** if it's an object/array etc.. */ + if (((Z_TYPE_P(offset) != IS_STRING) &&(Z_TYPE_P(offset) != IS_DOUBLE) + && (Z_TYPE_P(offset) != IS_NULL) && (Z_TYPE_P(offset) != IS_BOOL)) + || ((Z_TYPE_P(offset) == IS_STRING) + && (IS_LONG != is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, -1)))) { + result = 0; + } else { + ZVAL_COPY_VALUE(&tmp, offset); + zval_copy_ctor(&tmp); + convert_to_long(&tmp); + offset = &tmp; + } + } if (Z_TYPE_P(offset) == IS_LONG) { if (opline->extended_value & ZEND_ISSET) { |
Copyright © 2001-2024 The PHP Group All rights reserved. |
Last updated: Thu Mar 28 12:01:27 2024 UTC |