checks). (Nikita)
. Fixed bug #69084 (Unclear error message when not implementing a renamed
abstract trait function). (Nikita)
+ . Fixed bug #62609 (Allow implementing Traversable on abstract classes).
+ (Nikita)
- CURL:
. Bumped required libcurl version to 7.29.0. (cmb)
--- /dev/null
+--TEST--
+Bug #62609: Allow implementing Traversable on abstract classes (fail)
+--FILE--
+<?php
+
+abstract class AbstractTraversable implements Traversable {}
+
+class NonAbstractTraversable extends AbstractTraversable {}
+
+?>
+--EXPECT--
+Fatal error: Class NonAbstractTraversable must implement interface Traversable as part of either Iterator or IteratorAggregate in Unknown on line 0
--- /dev/null
+--TEST--
+Bug #62609: Allow implementing Traversable on abstract classes (work)
+--FILE--
+<?php
+
+abstract class AbstractTraversable implements Traversable {}
+
+class NonAbstractTraversable extends AbstractTraversable implements IteratorAggregate {
+ public function getIterator() {
+ yield "foo";
+ yield "bar";
+ }
+}
+
+foreach (new NonAbstractTraversable as $value) {
+ echo $value, "\n";
+}
+
+?>
+--EXPECT--
+foo
+bar
if (class_type->get_iterator || (class_type->parent && class_type->parent->get_iterator)) {
return SUCCESS;
}
+ /* Abstract class can implement Traversable only, in which case the extending class must
+ * implement Iterator or IteratorAggregate. */
+ if (class_type->ce_flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS) {
+ return SUCCESS;
+ }
if (class_type->num_interfaces) {
ZEND_ASSERT(class_type->ce_flags & ZEND_ACC_RESOLVED_INTERFACES);
for (i = 0; i < class_type->num_interfaces; i++) {