]> granicus.if.org Git - php/commitdiff
Revert to old behavior of $str["str"]. ($str["str"] is equivalent of $str[0])
authorDmitry Stogov <dmitry@php.net>
Fri, 14 Jan 2005 08:50:00 +0000 (08:50 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 14 Jan 2005 08:50:00 +0000 (08:50 +0000)
Zend/tests/bug31098.phpt
Zend/zend_execute.c

index 8e6c0277f96046378908ac91973bad4ff47fbafa..4347b10988fcac1b233a9f158ff1047325cd2b1c 100644 (file)
@@ -17,7 +17,7 @@ var_dump(isset($a{'b'}));
 
 $simpleString = "Bogus String Text";
 echo isset($simpleString->wrong)?"bug\n":"ok\n";
-echo isset($simpleString["wrong"])?"bug\n":"ok\n";
+echo isset($simpleString["wrong"])?"ok\n":"bug\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";
@@ -25,18 +25,18 @@ echo isset($simpleString["16"])?"ok\n":"bug\n";
 echo isset($simpleString["17"])?"bug\n":"ok\n";
 echo isset($simpleString["wrong"][0])?"bug\n":"ok\n";
 echo $simpleString->wrong === null?"ok\n":"bug\n";
-echo $simpleString["wrong"] === null?"ok\n":"bug\n";
+echo $simpleString["wrong"] === "B"?"ok\n":"bug\n";
 echo $simpleString["0"] === "B"?"ok\n":"bug\n";
 $simpleString["wrong"] = "f";
-echo $simpleString["0"] === "B"?"ok\n":"bug\n";
+echo $simpleString["0"] === "f"?"ok\n":"bug\n";
 ?>
 --EXPECTF--
 bool(false)
 bool(false)
 bool(false)
 bool(false)
-bool(false)
-bool(false)
+bool(true)
+bool(true)
 ok
 ok
 ok
@@ -46,12 +46,8 @@ ok
 ok
 ok
 
-Notice: Trying to get property of non-object in %sbug31098.php on line %d
+Notice: Trying to get property of non-object in /home/dmitry/php/php5.0/Zend/tests/bug31098.php on line 24
 ok
-
-Notice: Trying to get string index from a string in %sbug31098.php on line %d
 ok
 ok
-
-Notice: Trying to get string index from a string in %sbug31098.php on line %d
 ok
index e8bdb902a7a5dbe5a356291e9871206b77d7048e..7251dd323b5ef91d08a186341a418db3d0209207 100644 (file)
@@ -967,24 +967,7 @@ static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2,
 
                                offset = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
 
-                               if (Z_TYPE_P(offset) == IS_STRING) {
-                                       char *strval;
-                                       long  lval;
-
-                                       strval = Z_STRVAL_P(offset);
-                                       if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) {
-                                         ZVAL_LONG(&tmp, lval);
-                                               offset = &tmp;
-                                       } else {
-                                               if (type != BP_VAR_IS) {
-                                                       zend_error(E_NOTICE, "Trying to get string index from a string");
-                                               }
-                                               *retval = &EG(error_zval_ptr);;
-                                               SELECTIVE_PZVAL_LOCK(**retval, result);
-                                               FREE_OP(Ts, op2, EG(free_op2));
-                                               return;
-                                       }
-                               } else if (offset->type != IS_LONG) {
+                               if (offset->type != IS_LONG) {
                                        tmp = *offset;
                                        zval_copy_ctor(&tmp);
                                        convert_to_long(&tmp);
@@ -4052,16 +4035,7 @@ static int zend_isset_isempty_dim_prop_obj_handler(int prop_dim, ZEND_OPCODE_HAN
                } else if ((*container)->type == IS_STRING && !prop_dim) { /* string offsets */
                        zval tmp;
 
-                       if (Z_TYPE_P(offset) == IS_STRING) {
-                               char *strval;
-                               long  lval;
-
-                               strval = Z_STRVAL_P(offset);
-                               if (is_numeric_string(strval, Z_STRLEN_P(offset), &lval, NULL, 0) == IS_LONG) {
-                                       ZVAL_LONG(&tmp, lval);
-                                       offset = &tmp;
-                               }
-                       } else if (offset->type != IS_LONG) {
+                       if (offset->type != IS_LONG) {
                                tmp = *offset;
                                zval_copy_ctor(&tmp);
                                convert_to_long(&tmp);