Commit:    85c777d2f1d5a12fac0100f4953d33a7380d0b03
Author:    Gustavo André dos Santos Lopes <cataphr...@php.net>         Thu, 24 
May 2012 14:31:07 +0200
Parents:   f1969d4b4ce0ebd82b2582104bb99de4b5ac824e
Branches:  PHP-5.3 PHP-5.4 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=85c777d2f1d5a12fac0100f4953d33a7380d0b03

Log:
Fixed bug #55610: ResourceBundle and Traversable

Bugs:
https://bugs.php.net/55610

Changed paths:
  M  NEWS
  M  ext/intl/resourcebundle/resourcebundle_class.c
  A  ext/intl/tests/resourcebundle_traversable.phpt


Diff:
diff --git a/NEWS b/NEWS
index 174b5e6..5fa6ecb 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@ PHP                                                           
             NEWS
   . Fixed bug #62017 (datefmt_create with incorrectly encoded timezone leaks
     pattern). (Gustavo)
   . Fixed bug #60785 (memory leak in IntlDateFormatter constructor). (Gustavo)
+  . Fixed bug #55610 (ResourceBundle should implement Traversable). (stealth35)
 
 - XML Writer:
   . Fixed bug #62064 (memory leak in the XML Writer module). 
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c 
b/ext/intl/resourcebundle/resourcebundle_class.c
index 3bf3468..d2a29d9 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -427,6 +427,8 @@ void resourcebundle_register_class( TSRMLS_D )
        ResourceBundle_object_handlers.clone_obj          = NULL; /* ICU 
ResourceBundle has no clone implementation */
        ResourceBundle_object_handlers.read_dimension = 
resourcebundle_array_get;
        ResourceBundle_object_handlers.count_elements = 
resourcebundle_array_count;
+
+       zend_class_implements(ResourceBundle_ce_ptr TSRMLS_CC, 1, 
zend_ce_traversable);
 }
 /* }}} */
 
diff --git a/ext/intl/tests/resourcebundle_traversable.phpt 
b/ext/intl/tests/resourcebundle_traversable.phpt
new file mode 100644
index 0000000..1e6af7b
--- /dev/null
+++ b/ext/intl/tests/resourcebundle_traversable.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #55610: ResourceBundle does not implement Traversable
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+       include "resourcebundle.inc";
+
+       $r = new ResourceBundle( 'es', BUNDLE );
+
+       var_dump($r instanceof Traversable);
+       var_dump(iterator_to_array($r->get('testarray')));
+?>
+--EXPECTF--
+bool(true)
+array(3) {
+  [0]=>
+  string(8) "cadena 1"
+  [1]=>
+  string(8) "cadena 2"
+  [2]=>
+  string(8) "cadena 3"
+}


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

Reply via email to