?? ??? ????, PHP 7.2
- Core:
+ . "Countable" interface is moved from SPL to Core. (Dmitry)
. Added ZEND_IN_ARRAY instruction, implementing optimized in_array() builtin
function, through hash lookup in flipped array. (Dmitry)
. Removed IS_TYPE_IMMUTABLE (it's the same as COPYABLE & !REFCOUNTED). (Dmitry)
ZEND_API zend_class_entry *zend_ce_iterator;
ZEND_API zend_class_entry *zend_ce_arrayaccess;
ZEND_API zend_class_entry *zend_ce_serializable;
+ZEND_API zend_class_entry *zend_ce_countable;
/* {{{ zend_call_method
Only returns the returned zval if retval_ptr != NULL */
}
/* }}}*/
+/* {{{ zend_implement_countable */
+static int zend_implement_countable(zend_class_entry *interface, zend_class_entry *class_type)
+{
+ return SUCCESS;
+}
+/* }}}*/
+
/* {{{ function tables */
const zend_function_entry zend_funcs_aggregate[] = {
ZEND_ABSTRACT_ME(iterator, getIterator, NULL)
ZEND_FENTRY(unserialize, NULL, arginfo_serializable_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT|ZEND_ACC_CTOR)
ZEND_FE_END
};
+
+ZEND_BEGIN_ARG_INFO(arginfo_countable_count, 0)
+ZEND_END_ARG_INFO()
+
+const zend_function_entry zend_funcs_countable[] = {
+ ZEND_ABSTRACT_ME(Countable, count, arginfo_countable_count)
+ ZEND_FE_END
+};
/* }}} */
/* {{{ zend_register_interfaces */
REGISTER_MAGIC_INTERFACE(arrayaccess, ArrayAccess);
REGISTER_MAGIC_INTERFACE(serializable, Serializable);
+
+ REGISTER_MAGIC_INTERFACE(countable, Countable);
}
/* }}} */
extern ZEND_API zend_class_entry *zend_ce_iterator;
extern ZEND_API zend_class_entry *zend_ce_arrayaccess;
extern ZEND_API zend_class_entry *zend_ce_serializable;
+extern ZEND_API zend_class_entry *zend_ce_countable;
typedef struct _zend_user_iterator {
zend_object_iterator it;
INIT_CLASS_ENTRY(ce, "Phar", php_archive_methods);
phar_ce_archive = zend_register_internal_class_ex(&ce, spl_ce_RecursiveDirectoryIterator);
- zend_class_implements(phar_ce_archive, 2, spl_ce_Countable, zend_ce_arrayaccess);
+ zend_class_implements(phar_ce_archive, 2, zend_ce_countable, zend_ce_arrayaccess);
INIT_CLASS_ENTRY(ce, "PharData", php_archive_methods);
phar_ce_data = zend_register_internal_class_ex(&ce, spl_ce_RecursiveDirectoryIterator);
- zend_class_implements(phar_ce_data, 2, spl_ce_Countable, zend_ce_arrayaccess);
+ zend_class_implements(phar_ce_data, 2, zend_ce_countable, zend_ce_arrayaccess);
INIT_CLASS_ENTRY(ce, "PharFileInfo", php_entry_methods);
phar_ce_entry = zend_register_internal_class_ex(&ce, spl_ce_SplFileInfo);
ce_SimpleXMLIterator->create_object = ce_SimpleXMLElement->create_object;
zend_class_implements(ce_SimpleXMLIterator, 1, spl_ce_RecursiveIterator);
- zend_class_implements(ce_SimpleXMLIterator, 1, spl_ce_Countable);
+ zend_class_implements(ce_SimpleXMLIterator, 1, zend_ce_countable);
return SUCCESS;
}
SPL_ADD_CLASS(BadMethodCallException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(CachingIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(CallbackFilterIterator, z_list, sub, allow, ce_flags); \
- SPL_ADD_CLASS(Countable, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
function valid();
}
-/** @ingroup SPL
+/** @ingroup ZendEngine
* @brief This Interface allows to hook into the global count() function.
* @since PHP 5.1
*/
PHPAPI zend_class_entry *spl_ce_AppendIterator;
PHPAPI zend_class_entry *spl_ce_RegexIterator;
PHPAPI zend_class_entry *spl_ce_RecursiveRegexIterator;
-PHPAPI zend_class_entry *spl_ce_Countable;
PHPAPI zend_class_entry *spl_ce_RecursiveTreeIterator;
ZEND_BEGIN_ARG_INFO(arginfo_recursive_it_void, 0)
PHP_FE_END
};
-static const zend_function_entry spl_funcs_Countable[] = {
- SPL_ABSTRACT_ME(Countable, count, arginfo_recursive_it_void)
- PHP_FE_END
-};
-
/* {{{ PHP_MINIT_FUNCTION(spl_iterators)
*/
PHP_MINIT_FUNCTION(spl_iterators)
REGISTER_SPL_SUB_CLASS_EX(ParentIterator, RecursiveFilterIterator, spl_dual_it_new, spl_funcs_ParentIterator);
- REGISTER_SPL_INTERFACE(Countable);
REGISTER_SPL_INTERFACE(SeekableIterator);
REGISTER_SPL_ITERATOR(SeekableIterator);
#define spl_ce_Aggregate zend_ce_aggregate
#define spl_ce_ArrayAccess zend_ce_arrayaccess
#define spl_ce_Serializable zend_ce_serializable
+#define spl_ce_Countable zend_ce_countable
extern PHPAPI zend_class_entry *spl_ce_RecursiveIterator;
extern PHPAPI zend_class_entry *spl_ce_RecursiveIteratorIterator;
extern PHPAPI zend_class_entry *spl_ce_AppendIterator;
extern PHPAPI zend_class_entry *spl_ce_RegexIterator;
extern PHPAPI zend_class_entry *spl_ce_RecursiveRegexIterator;
-extern PHPAPI zend_class_entry *spl_ce_Countable;
extern PHPAPI zend_class_entry *spl_ce_CallbackFilterIterator;
extern PHPAPI zend_class_entry *spl_ce_RecursiveCallbackFilterIterator;
}
}
/* if not and the object implements Countable we call its count() method */
- if (instanceof_function(Z_OBJCE_P(array), spl_ce_Countable)) {
+ if (instanceof_function(Z_OBJCE_P(array), zend_ce_countable)) {
zend_call_method_with_0_params(array, NULL, NULL, "count", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
RETVAL_LONG(zval_get_long(&retval));