php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50148 [PATCH] - zend_get_property_info should check for Z_TYPE_P(member) == IS_STRING
Submitted: 2009-11-11 10:43 UTC Modified: 2009-11-11 17:12 UTC
From: yoarvi at gmail dot com Assigned:
Status: Closed Package: Unicode Engine related
PHP Version: 6SVN-2009-11-11 (SVN) OS: Solaris 10/SPARC
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: yoarvi at gmail dot com
New email:
PHP Version: OS:

 

 [2009-11-11 10:43 UTC] yoarvi at gmail dot com
Description:
------------
When I ran 'gmake test' on my PHP6 tree on Solaris 10 (SPARC), I noticed many test failures.



The following patch fixes many(~350) of these test failures:

Index: Zend/zend_object_handlers.c
===================================================================
--- Zend/zend_object_handlers.c (revision 290471)
+++ Zend/zend_object_handlers.c (working copy)
@@ -198,7 +198,7 @@
        ulong h;

        if ((Z_TYPE_P(member) == IS_UNICODE && Z_USTRVAL_P(member)[0] == 0) ||
-           Z_STRVAL_P(member)[0] == '\0') {
+           (Z_TYPE_P(member) == IS_STRING && Z_STRVAL_P(member)[0] == '\0')) {
                if (!silent) {
                        if (Z_UNILEN_P(member) == 0) {
                                zend_error(E_ERROR, "Cannot access empty property");


Reproduce code:
---------------
% sapi/cli/php tests/classes/__call_001.php


Expected result:
----------------
Method test called:
array(4) {
  [0]=>
  int(1)
  [1]=>
  unicode(1) "2"
  [2]=>
  float(3.4)
  [3]=>
  bool(true)
}
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
}


Actual result:
--------------
Method test called:
array(4) {
  [0]=>
  int(1)
  [1]=>
  unicode(1) "2"
  [2]=>
  float(3.4)
  [3]=>
  bool(true)
}

Fatal error: Cannot access property started with '\0' in /space/arvind/php-src-6/tests/classes/__call_001.phpt on line 14

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-11 17:12 UTC] felipe@php.net
This bug has been fixed in SVN.

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.

Thanks!
 [2009-11-11 17:13 UTC] svn@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=290512
Log: - Fixed bug #50148 (zend_get_property_info should check for Z_TYPE_P(member) == IS_STRING) patch by yoarvi at gmail dot com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 02:01:28 2024 UTC