SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ArrayObject, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(ArrayIterator, z_list, sub, allow, ce_flags); \
+ SPL_ADD_CLASS(BadFunctionCallException, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(CachingIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(CachingRecursiveIterator, z_list, sub, allow, ce_flags); \
SPL_ADD_CLASS(Countable, z_list, sub, allow, ce_flags); \
#include "spl_exceptions.h"
zend_class_entry *spl_ce_LogicException;
+zend_class_entry *spl_ce_BadFunctionCallException;
+zend_class_entry *spl_ce_BadMethodCallException;
zend_class_entry *spl_ce_DomainException;
zend_class_entry *spl_ce_InvalidArgumentException;
zend_class_entry *spl_ce_LengthException;
PHP_MINIT_FUNCTION(spl_exceptions)
{
REGISTER_SPL_SUB_CLASS_EX(LogicException, Exception, NULL, NULL);
+ REGISTER_SPL_SUB_CLASS_EX(BadFunctionCallException, LogicException, NULL, NULL);
+ REGISTER_SPL_SUB_CLASS_EX(BadMethodCallException, BadFunctionCallException, NULL, NULL);
REGISTER_SPL_SUB_CLASS_EX(DomainException, LogicException, NULL, NULL);
REGISTER_SPL_SUB_CLASS_EX(InvalidArgumentException, LogicException, NULL, NULL);
REGISTER_SPL_SUB_CLASS_EX(LengthException, LogicException, NULL, NULL);
#include "spl_iterators.h"
#include "spl_directory.h"
#include "spl_array.h"
+#include "spl_exceptions.h"
#define INLINE inline
if (child) {
zval_ptr_dtor(&child);
}
- zend_throw_exception(zend_exception_get_default(), "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC);
+ zend_throw_exception(spl_ce_InvalidArgumentException, "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC);
return;
}
if (object->mode == RIT_CHILD_FIRST) {
}
if (intern->u.limit.offset < 0) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- zend_throw_exception(zend_exception_get_default(), "Parameter offset must be > 0", 0 TSRMLS_CC);
+ zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be > 0", 0 TSRMLS_CC);
return NULL;
}
if (intern->u.limit.count < 0 && intern->u.limit.count != -1) {
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
- zend_throw_exception(zend_exception_get_default(), "Parameter count must either be -1 or a value greater than or equal 0", 0 TSRMLS_CC);
+ zend_throw_exception(spl_ce_OutOfRangeException, "Parameter count must either be -1 or a value greater than or equal 0", 0 TSRMLS_CC);
return NULL;
}
break;
spl_dual_it_free(intern TSRMLS_CC);
if (pos < intern->u.limit.offset) {
- zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC, "Cannot seek to %ld which is below the offset %ld", pos, intern->u.limit.offset);
+ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is below the offset %ld", pos, intern->u.limit.offset);
return;
}
if (pos > intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) {
- zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC, "Cannot seek to %ld which is behind offest %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count);
+ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is behind offest %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count);
return;
}
if (instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) {
intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
if (!(intern->u.caching.flags & CIT_CALL_TOSTRING)) {
- zend_throw_exception_ex(zend_exception_get_default(), 0 TSRMLS_CC, "%s does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name);
}
if (intern->u.caching.zstr) {
RETURN_STRINGL(Z_STRVAL_P(intern->u.caching.zstr), Z_STRLEN_P(intern->u.caching.zstr), 1);
Throws exception */
SPL_METHOD(EmptyIterator, key)
{
- zend_throw_exception(NULL, "Accessing the key of an EmptyIterator", 0 TSRMLS_CC);
+ zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the key of an EmptyIterator", 0 TSRMLS_CC);
} /* }}} */
/* {{{ proto EmptyIterator::current()
Throws exception */
SPL_METHOD(EmptyIterator, current)
{
- zend_throw_exception(NULL, "Accessing the value of an EmptyIterator", 0 TSRMLS_CC);
+ zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the value of an EmptyIterator", 0 TSRMLS_CC);
} /* }}} */
/* {{{ proto EmptyIterator::next()