$simpleString = "Bogus String Text";
echo isset($simpleString->wrong)?"bug\n":"ok\n";
-echo isset($simpleString["wrong"])?"ok\n":"bug\n";
+echo isset($simpleString["wrong"])?"bug\n":"ok\n";
echo isset($simpleString[-1])?"bug\n":"ok\n";
echo isset($simpleString[0])?"ok\n":"bug\n";
echo isset($simpleString["0"])?"ok\n":"bug\n";
bool(false)
bool(false)
bool(false)
-bool(true)
-bool(true)
+bool(false)
+bool(false)
ok
ok
ok
ok
ok
-Notice: Trying to get property of non-object in %sbug31098.php on line %d
-ok
+Notice: Trying to get property of non-object in %s on line %d
ok
+
+Warning: Illegal string offset 'wrong' in %s on line %d
ok
ok
+
+Warning: Illegal string offset 'wrong' in %s on line %d
+ok
\ No newline at end of file
error_reporting(E_ALL);
$a = 'foo';
-$a[11111111111];
+$a[111111111111111111111];
$a = '';
?>
--EXPECTF--
+Notice: String offset cast occured in %s on line %d
-Notice: Uninitialized string offset: %i in %s on line 6
+Notice: Uninitialized string offset: 0 in %s on line %d
-Notice: Uninitialized string offset: 0 in %s on line 10
+Notice: Uninitialized string offset: 0 in %s on line %d
-Notice: Uninitialized string offset: 0 in %s on line 12
+Notice: String offset cast occured in %s on line %d
-Notice: Uninitialized string offset: %i in %s on line 14
+Notice: Uninitialized string offset: %i in %s on line %d
-Notice: Uninitialized string offset: %i in %s on line 16
+Notice: String offset cast occured in %s on line %d
-Notice: Uninitialized string offset: 0 in %s on line 18
+Notice: Uninitialized string offset: %i in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line 28
+Notice: Uninitialized string offset: 0 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line 34
+Notice: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line 38
+Notice: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line 42
+Notice: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line 46
+Notice: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 12 in %s on line 50
+Notice: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 12 in %s on line 52
+Notice: String offset cast occured in %s on line %d
+
+Notice: Uninitialized string offset: 12 in %s on line %d
+
+Notice: String offset cast occured in %s on line %d
+
+Notice: Uninitialized string offset: 12 in %s on line %d
+
+Notice: String offset cast occured in %s on line %d
+
+Notice: String offset cast occured in %s on line %d
b
Done
echo "I am alive";
?>
--EXPECTF--
-Notice: Uninitialized string offset: 0 in %sbug39304.php on line 3
+Notice: Uninitialized string offset: 0 in %sbug39304.php on line %d
-Notice: Uninitialized string offset: 1 in %sbug39304.php on line 3
+Notice: Uninitialized string offset: 1 in %sbug39304.php on line %d
-Notice: Uninitialized string offset: 0 in %sbug39304.php on line 3
+Notice: Uninitialized string offset: 0 in %sbug39304.php on line %d
I am alive
var_dump($a,$b);
?>
--EXPECTF--
-Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line 3
+Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line %d
-Notice: Uninitialized string offset: 1 in %sbug39304_2_4.php on line 3
+Notice: Uninitialized string offset: 1 in %sbug39304_2_4.php on line %d
-Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line 3
+Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line %d
string(0) ""
string(0) ""
echo "ok\n";
?>
--EXPECTF--
-bool(true)
+bool(false)
Warning: Attempt to modify property of non-object in %sbug54262.php on line 4
--- /dev/null
+--TEST--
+Bug #60362: non-existent sub-sub keys should not have values
+--FILE--
+<?php
+$arr = array('exists' => 'foz');
+
+if (isset($arr['exists']['non_existent'])) {
+ echo "sub-key 'non_existent' is set: ";
+ var_dump($arr['exists']['non_existent']);
+} else {
+ echo "sub-key 'non_existent' is not set.\n";
+}
+if (isset($arr['exists'][1])) {
+ echo "sub-key 1 is set: ";
+ var_dump($arr['exists'][1]);
+} else {
+ echo "sub-key 1 is not set.\n";
+}
+
+echo "-------------------\n";
+if (isset($arr['exists']['non_existent']['sub_sub'])) {
+ echo "sub-key 'sub_sub' is set: ";
+ var_dump($arr['exists']['non_existent']['sub_sub']);
+} else {
+ echo "sub-sub-key 'sub_sub' is not set.\n";
+}
+if (isset($arr['exists'][1][0])) {
+ echo "sub-sub-key 0 is set: ";
+ var_dump($arr['exists'][1][0]);
+} else {
+ echo "sub-sub-key 0 is not set.\n";
+}
+
+echo "-------------------\n";
+if (empty($arr['exists']['non_existent'])) {
+ echo "sub-key 'non_existent' is empty.\n";
+} else {
+ echo "sub-key 'non_existent' is not empty: ";
+ var_dump($arr['exists']['non_existent']);
+}
+if (empty($arr['exists'][1])) {
+ echo "sub-key 1 is empty.\n";
+} else {
+ echo "sub-key 1 is not empty: ";
+ var_dump($arr['exists'][1]);
+}
+
+echo "-------------------\n";
+if (empty($arr['exists']['non_existent']['sub_sub'])) {
+ echo "sub-sub-key 'sub_sub' is empty.\n";
+} else {
+ echo "sub-sub-key 'sub_sub' is not empty: ";
+ var_dump($arr['exists']['non_existent']['sub_sub']);
+}
+if (empty($arr['exists'][1][0])) {
+ echo "sub-sub-key 0 is empty.\n";
+} else {
+ echo "sub-sub-key 0 is not empty: ";
+ var_dump($arr['exists'][1][0]);
+}
+echo "DONE";
+--EXPECT--
+sub-key 'non_existent' is not set.
+sub-key 1 is set: string(1) "o"
+-------------------
+sub-sub-key 'sub_sub' is not set.
+sub-sub-key 0 is set: string(1) "o"
+-------------------
+sub-key 'non_existent' is empty.
+sub-key 1 is not empty: string(1) "o"
+-------------------
+sub-sub-key 'sub_sub' is empty.
+sub-sub-key 0 is not empty: string(1) "o"
+DONE
--- /dev/null
+--TEST--
+Testing empty() with string offsets
+--FILE--
+<?php
+
+print "- empty ---\n";
+
+$str = "test0123";
+
+var_dump(empty($str[-1]));
+var_dump(empty($str[0]));
+var_dump(empty($str[1]));
+var_dump(empty($str[4])); // 0
+var_dump(empty($str[5])); // 1
+var_dump(empty($str[8]));
+var_dump(empty($str[10000]));
+// non-numeric offsets
+print "- string ---\n";
+var_dump(empty($str['-1']));
+var_dump(empty($str['0']));
+var_dump(empty($str['1']));
+var_dump(empty($str['4'])); // 0
+var_dump(empty($str['1.5']));
+var_dump(empty($str['good']));
+var_dump(empty($str['3 and a half']));
+print "- bool ---\n";
+var_dump(empty($str[true]));
+var_dump(empty($str[false]));
+var_dump(empty($str[false][true]));
+print "- null ---\n";
+var_dump(empty($str[null]));
+print "- double ---\n";
+var_dump(empty($str[-1.1]));
+var_dump(empty($str[-0.8]));
+var_dump(empty($str[-0.1]));
+var_dump(empty($str[0.2]));
+var_dump(empty($str[0.9]));
+var_dump(empty($str[M_PI]));
+var_dump(empty($str[100.5001]));
+print "- array ---\n";
+var_dump(empty($str[array()]));
+var_dump(empty($str[array(1,2,3)]));
+print "- object ---\n";
+var_dump(empty($str[new stdClass()]));
+print "- resource ---\n";
+$f = fopen(__FILE__, 'r');
+var_dump(empty($str[$f]));
+print "done\n";
+
+?>
+--EXPECTF--
+- empty ---
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+- string ---
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+
+Notice: A non well formed numeric value encountered in %s line %d
+bool(false)
+- bool ---
+bool(false)
+bool(false)
+bool(true)
+- null ---
+bool(false)
+- double ---
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+- array ---
+bool(true)
+bool(true)
+- object ---
+bool(true)
+- resource ---
+bool(true)
+done
}
}
+Warning: Illegal string offset 'foo' in %s on line %d
+
Notice: Array to string conversion in %s on line %d
string(1) "A"
--- /dev/null
+--TEST--
+Testing isset with string offsets
+--FILE--
+<?php
+
+print "- isset ---\n";
+
+$str = "test0123";
+
+var_dump(isset($str[-1]));
+var_dump(isset($str[0]));
+var_dump(isset($str[1]));
+var_dump(isset($str[4])); // 0
+var_dump(isset($str[5])); // 1
+var_dump(isset($str[8]));
+var_dump(isset($str[10000]));
+// non-numeric offsets
+print "- string ---\n";
+var_dump(isset($str['-1']));
+var_dump(isset($str['0']));
+var_dump(isset($str['1']));
+var_dump(isset($str['4'])); // 0
+var_dump(isset($str['1.5']));
+var_dump(isset($str['good']));
+var_dump(isset($str['3 and a half']));
+print "- bool ---\n";
+var_dump(isset($str[true]));
+var_dump(isset($str[false]));
+var_dump(isset($str[false][true]));
+print "- null ---\n";
+var_dump(isset($str[null]));
+print "- double ---\n";
+var_dump(isset($str[-1.1]));
+var_dump(isset($str[-0.8]));
+var_dump(isset($str[-0.1]));
+var_dump(isset($str[0.2]));
+var_dump(isset($str[0.9]));
+var_dump(isset($str[M_PI]));
+var_dump(isset($str[100.5001]));
+print "- array ---\n";
+var_dump(isset($str[array()]));
+var_dump(isset($str[array(1,2,3)]));
+print "- object ---\n";
+var_dump(isset($str[new stdClass()]));
+print "- resource ---\n";
+$f = fopen(__FILE__, 'r');
+var_dump(isset($str[$f]));
+print "done\n";
+
+?>
+--EXPECTF--
+- isset ---
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+- string ---
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+
+Notice: A non well formed numeric value encountered in %s line %d
+bool(true)
+- bool ---
+bool(true)
+bool(true)
+bool(false)
+- null ---
+bool(true)
+- double ---
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+- array ---
+bool(false)
+bool(false)
+- object ---
+bool(false)
+- resource ---
+bool(false)
+done
echo "Done\n";
?>
--EXPECTF--
-Fatal error: Cannot use string offset as an array in %s on line %d
+Warning: Illegal string offset 'x' in %soffset_assign.php on line %d
+
+Fatal error: Cannot use string offset as an array in %soffset_assign.php on line %d
var_dump($str[0.0836]);
var_dump($str[NULL]);
var_dump($str["run away"]);
+var_dump($str["13"]);
+var_dump($str["14.5"]);
+var_dump($str["15 and then some"]);
var_dump($str[TRUE]);
var_dump($str[FALSE]);
?>
--EXPECTF--
string(1) "i"
+
+Notice: String offset cast occured in %s on line %d
string(1) "S"
+
+Notice: String offset cast occured in %s on line %d
string(1) "S"
+
+Warning: Illegal string offset 'run away' in %s on line %d
string(1) "S"
+string(1) "c"
+
+Warning: Illegal string offset '14.5' in %s on line %d
+string(1) "o"
+
+Notice: A non well formed numeric value encountered in %s on line %d
+string(1) "r"
+
+Notice: String offset cast occured in %s on line %d
string(1) "i"
+
+Notice: String offset cast occured in %s on line %d
string(1) "S"
Warning: Illegal offset type in %s on line %d
Warning: Illegal offset type in %s on line %d
string(1) "i"
-Done
+Done
\ No newline at end of file
$x->y;
echo "ok\n";
--EXPECTF--
-Notice: Uninitialized string offset: 3 in %sresult_unused.php on line 11
+Notice: Uninitialized string offset: 3 in %sresult_unused.php on line %d
ok
foo($str[2][1]);\r
?>\r
--EXPECTF--\r
-Notice: Uninitialized string offset: -1 in %sstr_offset_001.php on line 7\r
+Notice: Uninitialized string offset: -1 in %sstr_offset_001.php on line %d\r
string(0) ""\r
string(1) "a"\r
string(1) "b"\r
string(1) "c"\r
\r
-Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line 11\r
+Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line %d\r
string(0) ""\r
string(1) "b"\r
\r
-Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line 13\r
+Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line %d\r
string(0) ""\r
\r
-Notice: Uninitialized string offset: -1 in %sstr_offset_001.php on line 15\r
+Notice: Uninitialized string offset: -1 in %sstr_offset_001.php on line %d\r
string(0) ""\r
string(1) "a"\r
string(1) "b"\r
string(1) "c"\r
\r
-Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line 19\r
+Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line %d\r
string(0) ""\r
string(1) "b"\r
\r
-Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line 21\r
+Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line %d\r
string(0) ""\r
}
if (Z_TYPE_P(dim) != IS_LONG) {
+
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, "Illegal string offset '%s'", dim->value.str.val);
+ }
+
+ break;
case IS_DOUBLE:
case IS_NULL:
case IS_BOOL:
- /* do nothing */
+ zend_error(E_NOTICE, "String offset cast occured");
break;
default:
zend_error(E_WARNING, "Illegal offset type");
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_IS) {
+ zend_error(E_WARNING, "Illegal string offset '%s'", dim->value.str.val);
+ }
+ break;
case IS_DOUBLE:
case IS_NULL:
case IS_BOOL:
- /* do nothing */
+ if (type != BP_VAR_IS) {
+ zend_error(E_NOTICE, "String offset cast occured");
+ }
break;
default:
zend_error(E_WARNING, "Illegal offset type");
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {