[PHP-CVS] svn: /php/php-src/trunk/ UPGRADING ext/simplexml/simplexml.c ext/simplexml/tests/034.phpt ext/simplexml/tests/bug51615.phpt

2011-05-17 Thread Andrew Curioso
acurioso Tue, 17 May 2011 13:50:48 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=311138

Log:
Use iterator when necessary to get the full properties hash - consistent with 
count (see test: ext/simplexml/tests/034.phpt)

Changed paths:
U   php/php-src/trunk/UPGRADING
U   php/php-src/trunk/ext/simplexml/simplexml.c
U   php/php-src/trunk/ext/simplexml/tests/034.phpt
U   php/php-src/trunk/ext/simplexml/tests/bug51615.phpt

Modified: php/php-src/trunk/UPGRADING
===
--- php/php-src/trunk/UPGRADING 2011-05-17 13:20:28 UTC (rev 311137)
+++ php/php-src/trunk/UPGRADING 2011-05-17 13:50:48 UTC (rev 311138)
@@ -170,6 +170,10 @@
 - fclose() closes streams with resource refcount  1; it doesn't merely
   decrement the resource refcount.
 - socket_set_options() and socket_get_options() now support multicast options.
+- Arrays cast from SimpleXMLElement now always contain all nodes instead of
+  just the first matching node.
+- All SimpleXMLElement children are now always printed when using var_dump(),
+  var_export(), and print_r().

 ===
 5. Changes made to existing methods

Modified: php/php-src/trunk/ext/simplexml/simplexml.c
===
--- php/php-src/trunk/ext/simplexml/simplexml.c 2011-05-17 13:20:28 UTC (rev 
311137)
+++ php/php-src/trunk/ext/simplexml/simplexml.c 2011-05-17 13:50:48 UTC (rev 
311138)
@@ -1069,7 +1069,11 @@
xmlAttrPtr   attr;
int  namelen;
int  test;
+   char use_iter;
+   zval*iter_data;

+   use_iter = 0;
+
sxe = php_sxe_fetch_object(object TSRMLS_CC);

if (is_debug) {
@@ -1122,6 +1126,7 @@

GET_NODE(sxe, node);
node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
+
if (node  sxe-iter.type != SXE_ITER_ATTRLIST) {
if (node-type == XML_ATTRIBUTE_NODE) {
MAKE_STD_ZVAL(value);
@@ -1129,7 +1134,17 @@
zend_hash_next_index_insert(rv, value, sizeof(zval *), 
NULL);
node = NULL;
} else if (sxe-iter.type != SXE_ITER_CHILD) {
-   node = node-children;
+
+   if ( !node-children || !node-parent || 
node-children-next || node-children-children || node-parent-children == 
node-parent-last ) {
+   node = node-children;
+   } else {
+   iter_data = sxe-iter.data;
+   sxe-iter.data = NULL;
+
+   node = php_sxe_reset_iterator(sxe, 0 TSRMLS_CC);
+
+   use_iter = 1;
+   }
}

while (node) {
@@ -1161,12 +1176,27 @@

_get_base_node_value(sxe, node, value, 
sxe-iter.nsprefix, sxe-iter.isprefix TSRMLS_CC);

-   sxe_properties_add(rv, name, namelen, value TSRMLS_CC);
+   if ( use_iter ) {
+   zend_hash_next_index_insert(rv, value, 
sizeof(zval *), NULL);
+   } else {
+   sxe_properties_add(rv, name, namelen, value 
TSRMLS_CC);
+   }
 next_iter:
-   node = node-next;
+   if ( use_iter ) {
+   node = php_sxe_iterator_fetch(sxe, node-next, 
0 TSRMLS_CC);
+   } else {
+   node = node-next;
+   }
}
}

+   if ( use_iter ) {
+   if (sxe-iter.data) {
+   zval_ptr_dtor(sxe-iter.data);
+   }
+   sxe-iter.data = iter_data;
+   }
+
return rv;
 }
 /* }}} */

Modified: php/php-src/trunk/ext/simplexml/tests/034.phpt
===
--- php/php-src/trunk/ext/simplexml/tests/034.phpt  2011-05-17 13:20:28 UTC 
(rev 311137)
+++ php/php-src/trunk/ext/simplexml/tests/034.phpt  2011-05-17 13:50:48 UTC 
(rev 311138)
@@ -1,7 +1,7 @@
 --TEST--
-SimpleXML: array casting bug
---XFAIL--
-Does anyone know why?
+SimpleXML: cast to array
+--FAIL--
+Length of cast array does not match expected length
 --SKIPIF--
 ?php if (!extension_loaded(simplexml)) print skip; ?
 --FILE--

Modified: php/php-src/trunk/ext/simplexml/tests/bug51615.phpt
===
--- php/php-src/trunk/ext/simplexml/tests/bug51615.phpt 2011-05-17 13:20:28 UTC 
(rev 311137)
+++ php/php-src/trunk/ext/simplexml/tests/bug51615.phpt 2011-05-17 13:50:48 UTC 
(rev 311138)
@@ -20,7 +20,7 @@
 Warning: DOMDocument::loadHTML(): error parsing attribute name in Entity, 
line: 1 in %s on line %d

 Warning: 

Re: [PHP-CVS] svn: /php/php-src/trunk/ UPGRADING ext/simplexml/simplexml.c ext/simplexml/tests/034.phpt ext/simplexml/tests/bug51615.phpt

2011-05-17 Thread Kalle Sommer Nielsen
Hi

2011/5/17 Andrew Curioso acuri...@php.net:
 acurioso                                 Tue, 17 May 2011 13:50:48 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=311138

 Log:
 Use iterator when necessary to get the full properties hash - consistent with 
 count (see test: ext/simplexml/tests/034.phpt)

Shouldn't this be merged to PHP_5_4 aswell?

-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

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



Re: [PHP-CVS] svn: /php/php-src/trunk/ UPGRADING ext/simplexml/simplexml.c ext/simplexml/tests/034.phpt ext/simplexml/tests/bug51615.phpt

2011-05-17 Thread Andrew Curioso
I didn't realize that branch was created. It should be in PHP_5_4, yes.

I'm new to the team... so can you help me out? What is the standard way to
do that?
Using svn merge or just patch the code directly in the branch?

Thanks in advance,
- Andrew


On Tue, May 17, 2011 at 10:26 AM, Kalle Sommer Nielsen ka...@php.netwrote:

 Hi

 2011/5/17 Andrew Curioso acuri...@php.net:
  acurioso Tue, 17 May 2011 13:50:48 +
 
  Revision: http://svn.php.net/viewvc?view=revisionrevision=311138
 
  Log:
  Use iterator when necessary to get the full properties hash - consistent
 with count (see test: ext/simplexml/tests/034.phpt)

 Shouldn't this be merged to PHP_5_4 aswell?

 --
 regards,

 Kalle Sommer Nielsen
 ka...@php.net



Re: [PHP-CVS] svn: /php/php-src/trunk/ UPGRADING ext/simplexml/simplexml.c ext/simplexml/tests/034.phpt ext/simplexml/tests/bug51615.phpt

2011-05-17 Thread Pierre Joye
hi,

Whatever fits for you for this commit.

For the next commits, please try to commit to all branches at once,
see https://wiki.php.net/vcs/svnfaq about how to do a sparse checkout,
then you can simply do a commit like:

cd php-src
svn commit branches/PHP_5_4 trunk/

Cheers,

On Tue, May 17, 2011 at 4:43 PM, Andrew Curioso acuri...@php.net wrote:
 I didn't realize that branch was created. It should be in PHP_5_4, yes.

 I'm new to the team... so can you help me out? What is the standard way to
 do that?
 Using svn merge or just patch the code directly in the branch?

 Thanks in advance,
 - Andrew


 On Tue, May 17, 2011 at 10:26 AM, Kalle Sommer Nielsen ka...@php.netwrote:

 Hi

 2011/5/17 Andrew Curioso acuri...@php.net:
  acurioso                                 Tue, 17 May 2011 13:50:48 +
 
  Revision: http://svn.php.net/viewvc?view=revisionrevision=311138
 
  Log:
  Use iterator when necessary to get the full properties hash - consistent
 with count (see test: ext/simplexml/tests/034.phpt)

 Shouldn't this be merged to PHP_5_4 aswell?

 --
 regards,

 Kalle Sommer Nielsen
 ka...@php.net





-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-CVS] svn: /php/php-src/trunk/ UPGRADING ext/simplexml/simplexml.c ext/simplexml/tests/034.phpt ext/simplexml/tests/bug51615.phpt

2011-05-17 Thread Andrew Curioso
Thank you.

I'll read through that sparse checkout documentation and also commit to the
branch in a few hours.
I'd do it now but unfortunately I have a meeting to run to.

Thanks again,
- Andrew


On Tue, May 17, 2011 at 10:59 AM, Pierre Joye pierre@gmail.com wrote:

 hi,

 Whatever fits for you for this commit.

 For the next commits, please try to commit to all branches at once,
 see https://wiki.php.net/vcs/svnfaq about how to do a sparse checkout,
 then you can simply do a commit like:

 cd php-src
 svn commit branches/PHP_5_4 trunk/

 Cheers,

 On Tue, May 17, 2011 at 4:43 PM, Andrew Curioso acuri...@php.net wrote:
  I didn't realize that branch was created. It should be in PHP_5_4, yes.
 
  I'm new to the team... so can you help me out? What is the standard way
 to
  do that?
  Using svn merge or just patch the code directly in the branch?
 
  Thanks in advance,
  - Andrew
 
 
  On Tue, May 17, 2011 at 10:26 AM, Kalle Sommer Nielsen ka...@php.net
 wrote:
 
  Hi
 
  2011/5/17 Andrew Curioso acuri...@php.net:
   acurioso Tue, 17 May 2011 13:50:48
 +
  
   Revision: http://svn.php.net/viewvc?view=revisionrevision=311138
  
   Log:
   Use iterator when necessary to get the full properties hash -
 consistent
  with count (see test: ext/simplexml/tests/034.phpt)
 
  Shouldn't this be merged to PHP_5_4 aswell?
 
  --
  regards,
 
  Kalle Sommer Nielsen
  ka...@php.net
 
 



 --
 Pierre

 @pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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