ID:               31098
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jyounger at caedic dot com
 Status:           Closed
 Bug Type:         Zend Engine 2 problem
 Operating System: *
 PHP Version:      5CVS-2005-01-10
 Assigned To:      dmitry
 New Comment:

The patch for HEAD is incorrect.

You must not edit zend_vm_execute.h directly. You must edit
zend_vm_def.h and then generate zend_vm_execute.h with zend_vm_gen.php.
See README.ZEND_VM for more details.

I fixed this.

Also isset($str['str']) returned true, that is wrong from my point of
view.

I modified the patch to return false and notification in
zend_fetch_dimension_address().




Previous Comments:
------------------------------------------------------------------------

[2005-01-11 23:05:29] [EMAIL PROTECTED]

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------

[2005-01-10 15:27:15] [EMAIL PROTECTED]

Dmitry breaks, Dmitry fixes. :)


------------------------------------------------------------------------

[2005-01-03 03:51:38] jkkn at jkkn dot dk

I am using PEAR::DB which was the main reason I wrote the patch. The
supplied patch should solve all problems with regards to PEAR::DB.

Matthew, what do you experience while using the patch?

------------------------------------------------------------------------

[2004-12-31 18:58:56] mnorth at ucsd dot edu

This bug is rather significant to anyone that uses PEAR::DB with
DB_DataObject.  It effectively breaks the createTables.php script,
which in turn effectively makes useless DB_DataObject.  The offending
code is the first line of function tableInfo in
(phproot)/lib/php/DB/mysql.php:

     * @see DB_common::tableInfo()
     */
    function tableInfo($result, $mode = null) {
        if (isset($result->result)) {
            /*
             * Probably received a result object.


The isset() call returns true, regardless of whether $result->result is
set, and even if $result is not an object.  Note, this affects ALL
(phproot)/lib/php/DB/??sql.php files, since they all contain
tableInfo() functions.

The patch supplied in this bug report doesn't solve the problem, so I
had to temporarily change function tableInfo() to call is_object()
instead of isset().

Matthew H. North

------------------------------------------------------------------------

[2004-12-20 02:10:49] jkkn at jkkn dot dk

At time patching for bug #2 9883, 'dmitry'not only applied the patch,
but also added autocasting for the offset, therefore:
isset($simpleString['nonExistentStringProperty']) is currenly
autocasted into isset($simpleString[0]) - which is true.

Same goes for empty() since this is the same function.

This patch should resolve this problem:
Index: ZendEngine2/zend_execute.c
===================================================================
RCS file: /repository/ZendEngine2/zend_execute.c,v
retrieving revision 1.652.2.11
diff -u -r1.652.2.11 zend_execute.c
--- ZendEngine2/zend_execute.c  1 Dec 2004 14:01:58 -0000       1.652.2.11
+++ ZendEngine2/zend_execute.c  20 Dec 2004 01:08:28 -0000
@@ -4033,26 +4033,20 @@
                                result = 
Z_OBJ_HT_P(*container)->has_dimension(*container, offset,
(opline->extended_value == ZEND_ISEMPTY) TSRMLS_CC);
                        }
                } else if ((*container)->type == IS_STRING) { /* string offsets 
*/
-                       zval tmp_offset;
-
-                       if (Z_TYPE_P(offset) != IS_LONG) {
-                               tmp_offset = *offset;
-                               zval_copy_ctor(&tmp_offset);
-                               convert_to_long(&tmp_offset);
-                               offset = &tmp_offset;
-                       }
-                       switch (opline->extended_value) {
-                               case ZEND_ISSET:
-                                       if (offset->value.lval >= 0 && 
offset->value.lval <
Z_STRLEN_PP(container)) {
-                                               result = 1;
-                                       }
-                                       break;
-                               case ZEND_ISEMPTY:
-                                       if (offset->value.lval >= 0 && 
offset->value.lval <
Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] !=
'0') {
-                                               result = 1;
-                                       }
-                                       break;
-                       }
+                       if (Z_TYPE_P(offset) == IS_LONG) {
+                       switch (opline->extended_value) {
+                               case ZEND_ISSET:
+                                       if (offset->value.lval >= 0 && 
offset->value.lval <
Z_STRLEN_PP(container)) {
+                                               result = 1;
+                                       }
+                                       break;
+                               case ZEND_ISEMPTY:
+                                       if (offset->value.lval >= 0 && 
offset->value.lval <
Z_STRLEN_PP(container) && Z_STRVAL_PP(container)[offset->value.lval] !=
'0') {
+                                               result = 1;
+                                       }
+                                       break;
+                       }
+            }
                }
        }
        


Besides this the files "zend_vm_execute.h" and "zend_vm_execute.h" seem
to have been messed up in CVS HEAD at the same commit?!.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/31098

-- 
Edit this bug report at http://bugs.php.net/?id=31098&edit=1

Reply via email to