helly           Thu May 25 09:51:58 2006 UTC

  Added files:                 
    /php-src/ext/wddx/tests     bug37587.phpt 

  Modified files:              
    /php-src/ext/wddx   wddx.c 
  Log:
  - Bugfix 37587
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/wddx/wddx.c?r1=1.132&r2=1.133&diff_format=u
Index: php-src/ext/wddx/wddx.c
diff -u php-src/ext/wddx/wddx.c:1.132 php-src/ext/wddx/wddx.c:1.133
--- php-src/ext/wddx/wddx.c:1.132       Sun Apr 23 16:02:51 2006
+++ php-src/ext/wddx/wddx.c     Thu May 25 09:51:58 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: wddx.c,v 1.132 2006/04/23 16:02:51 iliaa Exp $ */
+/* $Id: wddx.c,v 1.133 2006/05/25 09:51:58 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -752,7 +752,7 @@
        } else if (!strcmp(name, EL_CHAR)) {
                int i;
                
-               for (i = 0; atts[i]; i++) {
+               if (atts) for (i = 0; atts[i]; i++) {
                        if (!strcmp(atts[i], EL_CHAR_CODE) && atts[++i] && 
atts[i][0]) {
                                char tmp_buf[2];
 
@@ -772,7 +772,7 @@
        } else if (!strcmp(name, EL_BOOLEAN)) {
                int i;
 
-               for (i = 0; atts[i]; i++) {
+               if (atts) for (i = 0; atts[i]; i++) {
                        if (!strcmp(atts[i], EL_VALUE) && atts[++i] && 
atts[i][0]) {
                                ent.type = ST_BOOLEAN;
                                SET_STACK_VARNAME;
@@ -813,7 +813,7 @@
        } else if (!strcmp(name, EL_VAR)) {
                int i;
                
-               for (i = 0; atts[i]; i++) {
+               if (atts) for (i = 0; atts[i]; i++) {
                        if (!strcmp(atts[i], EL_NAME) && atts[++i] && 
atts[i][0]) {
                                char *decoded;
                                int decoded_len;
@@ -830,7 +830,7 @@
                MAKE_STD_ZVAL(ent.data);
                array_init(ent.data);
 
-               for (i = 0; atts[i]; i++) {
+               if (atts) for (i = 0; atts[i]; i++) {
                        if (!strcmp(atts[i], "fieldNames") && atts[++i] && 
atts[i][0]) {
                                zval *tmp;
                                char *key;
@@ -870,7 +870,7 @@
                ent.varname = NULL;
                ent.data = NULL;
 
-               for (i = 0; atts[i]; i++) {
+               if (atts) for (i = 0; atts[i]; i++) {
                        if (!strcmp(atts[i], EL_NAME) && atts[++i] && 
atts[i][0]) {
                                char *decoded;
                                int decoded_len;

http://cvs.php.net/viewcvs.cgi/php-src/ext/wddx/tests/bug37587.phpt?view=markup&rev=1.1
Index: php-src/ext/wddx/tests/bug37587.phpt
+++ php-src/ext/wddx/tests/bug37587.phpt
--TEST--
Bug #37587 (var without attribute causes segfault)
--FILE--
<?php

var_dump(wddx_deserialize(file_get_contents(<<<EOF
data:,<wddxPacket version='1.0'>
<header/>
<data>
  <array length='1'>
    <var>
      <struct>
        <var name='test'><string>Hello World</string></var>
      </struct>
    </var>
  </array>
</data>
</wddxPacket>
EOF
)));

?>
===DONE===
--EXPECT--
array(1) {
  [0]=>
  array(1) {
    ["test"]=>
    string(11) "Hello World"
  }
}
===DONE===
--UEXPECT--
array(1) {
  [0]=>
  array(1) {
    [u"test"]=>
    string(11) "Hello World"
  }
}
===DONE===

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to