From 85c777d2f1d5a12fac0100f4953d33a7380d0b03 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Thu, 24 May 2012 14:31:07 +0200 Subject: [PATCH] Fixed bug #55610: ResourceBundle and Traversable --- NEWS | 1 + .../resourcebundle/resourcebundle_class.c | 2 ++ .../tests/resourcebundle_traversable.phpt | 23 +++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 ext/intl/tests/resourcebundle_traversable.phpt diff --git a/NEWS b/NEWS index 174b5e6dc4..5fa6ecbcd1 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 3bf3468e37..d2a29d9b25 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 0000000000..1e6af7b909 --- /dev/null +++ b/ext/intl/tests/resourcebundle_traversable.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #55610: ResourceBundle does not implement Traversable +--SKIPIF-- + +--FILE-- +get('testarray'))); +?> +--EXPECTF-- +bool(true) +array(3) { + [0]=> + string(8) "cadena 1" + [1]=> + string(8) "cadena 2" + [2]=> + string(8) "cadena 3" +} -- 2.40.0