|
34 | 34 | #include "spl_iterators.h"
|
35 | 35 | #include "spl_directory.h"
|
36 | 36 | #include "spl_array.h"
|
| 37 | +#include "spl_exceptions.h" |
37 | 38 |
|
38 | 39 | #define INLINE inline
|
39 | 40 |
|
@@ -244,7 +245,7 @@ static void spl_recursive_it_move_forward_ex(spl_recursive_it_object *object TSR
|
244 | 245 | if (child) {
|
245 | 246 | zval_ptr_dtor(&child);
|
246 | 247 | }
|
247 |
| - zend_throw_exception(zend_exception_get_default(), "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC); |
| 248 | + zend_throw_exception(spl_ce_InvalidArgumentException, "Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator", 0 TSRMLS_CC); |
248 | 249 | return;
|
249 | 250 | }
|
250 | 251 | if (object->mode == RIT_CHILD_FIRST) {
|
@@ -612,12 +613,12 @@ static INLINE spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAME
|
612 | 613 | }
|
613 | 614 | if (intern->u.limit.offset < 0) {
|
614 | 615 | php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
|
615 |
| - zend_throw_exception(zend_exception_get_default(), "Parameter offset must be > 0", 0 TSRMLS_CC); |
| 616 | + zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be > 0", 0 TSRMLS_CC); |
616 | 617 | return NULL;
|
617 | 618 | }
|
618 | 619 | if (intern->u.limit.count < 0 && intern->u.limit.count != -1) {
|
619 | 620 | php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
|
620 |
| - zend_throw_exception(zend_exception_get_default(), "Parameter count must either be -1 or a value greater than or equal 0", 0 TSRMLS_CC); |
| 621 | + zend_throw_exception(spl_ce_OutOfRangeException, "Parameter count must either be -1 or a value greater than or equal 0", 0 TSRMLS_CC); |
621 | 622 | return NULL;
|
622 | 623 | }
|
623 | 624 | break;
|
@@ -1041,11 +1042,11 @@ static INLINE void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS
|
1041 | 1042 |
|
1042 | 1043 | spl_dual_it_free(intern TSRMLS_CC);
|
1043 | 1044 | if (pos < intern->u.limit.offset) {
|
1044 |
| - 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); |
| 1045 | + 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); |
1045 | 1046 | return;
|
1046 | 1047 | }
|
1047 | 1048 | if (pos > intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) {
|
1048 |
| - 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); |
| 1049 | + 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); |
1049 | 1050 | return;
|
1050 | 1051 | }
|
1051 | 1052 | if (instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) {
|
@@ -1325,7 +1326,7 @@ SPL_METHOD(CachingIterator, __toString)
|
1325 | 1326 | intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
1326 | 1327 |
|
1327 | 1328 | if (!(intern->u.caching.flags & CIT_CALL_TOSTRING)) {
|
1328 |
| - 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); |
| 1329 | + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "%s does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(getThis())->name); |
1329 | 1330 | }
|
1330 | 1331 | if (intern->u.caching.zstr) {
|
1331 | 1332 | RETURN_STRINGL(Z_STRVAL_P(intern->u.caching.zstr), Z_STRLEN_P(intern->u.caching.zstr), 1);
|
@@ -1554,14 +1555,14 @@ SPL_METHOD(EmptyIterator, valid)
|
1554 | 1555 | Throws exception */
|
1555 | 1556 | SPL_METHOD(EmptyIterator, key)
|
1556 | 1557 | {
|
1557 |
| - zend_throw_exception(NULL, "Accessing the key of an EmptyIterator", 0 TSRMLS_CC); |
| 1558 | + zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the key of an EmptyIterator", 0 TSRMLS_CC); |
1558 | 1559 | } /* }}} */
|
1559 | 1560 |
|
1560 | 1561 | /* {{{ proto EmptyIterator::current()
|
1561 | 1562 | Throws exception */
|
1562 | 1563 | SPL_METHOD(EmptyIterator, current)
|
1563 | 1564 | {
|
1564 |
| - zend_throw_exception(NULL, "Accessing the value of an EmptyIterator", 0 TSRMLS_CC); |
| 1565 | + zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the value of an EmptyIterator", 0 TSRMLS_CC); |
1565 | 1566 | } /* }}} */
|
1566 | 1567 |
|
1567 | 1568 | /* {{{ proto EmptyIterator::next()
|
|
0 commit comments