]> granicus.if.org Git - php/commitdiff
throw a warning when using invalid offset types with strings
authorAntony Dovgal <tony2001@php.net>
Thu, 1 Jun 2006 11:56:23 +0000 (11:56 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 1 Jun 2006 11:56:23 +0000 (11:56 +0000)
Zend/zend_execute.c

index e2bd803857ff9d4b430b692e39875b06062be70a..3f56528a8c4064e1e4249ded2bb35b0f44af6089 100644 (file)
@@ -1112,6 +1112,20 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container
                                }
 
                                if (Z_TYPE_P(dim) != IS_LONG) {
+                                       switch(Z_TYPE_P(dim)) {
+                                               /* case IS_LONG: */
+                                               case IS_STRING:
+                                               case IS_UNICODE:
+                                               case IS_DOUBLE:
+                                               case IS_NULL:
+                                               case IS_BOOL:
+                                                       /* do nothing */
+                                                       break;
+                                               default:
+                                                       zend_error(E_WARNING, "Illegal offset type");
+                                                       break;
+                                       }
+
                                        tmp = *dim;
                                        zval_copy_ctor(&tmp);
                                        convert_to_long(&tmp);