mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
Use RETURN_THROWS() after zend_throw_exception() in most of the extensions
This commit is contained in:
parent
a6486088f8
commit
01a50778d1
@ -268,7 +268,7 @@ static PHP_FUNCTION(json_encode)
|
||||
if (encoder.error_code != PHP_JSON_ERROR_NONE) {
|
||||
smart_str_free(&buf);
|
||||
zend_throw_exception(php_json_exception_ce, php_json_get_error_msg(encoder.error_code), encoder.error_code);
|
||||
RETURN_FALSE;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1267,7 +1267,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
|
||||
* argument passed by reference.
|
||||
*/
|
||||
zend_throw_exception(zend_ce_exception, "Parameter ctor_params must be an array", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ static PHP_METHOD(PDO, dbh_constructor)
|
||||
snprintf(alt_dsn, sizeof(alt_dsn), "pdo.dsn.%s", data_source);
|
||||
if (FAILURE == cfg_get_string(alt_dsn, &ini_dsn)) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0, "invalid data source name");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
data_source = ini_dsn;
|
||||
@ -234,7 +234,7 @@ static PHP_METHOD(PDO, dbh_constructor)
|
||||
|
||||
if (!colon) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0, "invalid data source name (via INI: %s)", alt_dsn);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,12 +243,12 @@ static PHP_METHOD(PDO, dbh_constructor)
|
||||
data_source = dsn_from_uri(data_source + sizeof("uri:")-1, alt_dsn, sizeof(alt_dsn));
|
||||
if (!data_source) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0, "invalid data source URI");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
colon = strchr(data_source, ':');
|
||||
if (!colon) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0, "invalid data source name (via URI)");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ static PHP_METHOD(PDO, dbh_constructor)
|
||||
/* NB: don't want to include the data_source in the error message as
|
||||
* it might contain a password */
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0, "could not find driver");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
dbh = Z_PDO_DBH_P(object);
|
||||
@ -567,14 +567,14 @@ static PHP_METHOD(PDO, beginTransaction)
|
||||
|
||||
if (dbh->in_txn) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0, "There is already an active transaction");
|
||||
RETURN_FALSE;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (!dbh->methods->begin) {
|
||||
/* TODO: this should be an exception; see the auto-commit mode
|
||||
* comments below */
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0, "This driver doesn't support transactions");
|
||||
RETURN_FALSE;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (dbh->methods->begin(dbh)) {
|
||||
@ -600,7 +600,7 @@ static PHP_METHOD(PDO, commit)
|
||||
|
||||
if (!dbh->in_txn) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0, "There is no active transaction");
|
||||
RETURN_FALSE;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (dbh->methods->commit(dbh)) {
|
||||
@ -626,7 +626,7 @@ static PHP_METHOD(PDO, rollBack)
|
||||
|
||||
if (!dbh->in_txn) {
|
||||
zend_throw_exception_ex(php_pdo_get_exception(), 0, "There is no active transaction");
|
||||
RETURN_FALSE;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (dbh->methods->rollback(dbh)) {
|
||||
|
@ -2840,7 +2840,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
|
||||
* argument passed by reference.
|
||||
*/
|
||||
zend_throw_exception(zend_ce_exception, "Parameter ctor_params must be an array", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2283,15 +2283,15 @@ SXE_METHOD(__construct)
|
||||
|
||||
if (ZEND_SIZE_T_INT_OVFL(data_len)) {
|
||||
zend_throw_exception(zend_ce_exception, "Data is too long", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
if (ZEND_SIZE_T_INT_OVFL(ns_len)) {
|
||||
zend_throw_exception(zend_ce_exception, "Namespace is too long", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
if (ZEND_LONG_EXCEEDS_INT(options)) {
|
||||
zend_throw_exception(zend_ce_exception, "Invalid options", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
docp = is_url ? xmlReadFile(data, NULL, (int)options) : xmlReadMemory(data, (int)data_len, NULL, NULL, (int)options);
|
||||
@ -2299,7 +2299,7 @@ SXE_METHOD(__construct)
|
||||
if (!docp) {
|
||||
((php_libxml_node_object *)sxe)->document = NULL;
|
||||
zend_throw_exception(zend_ce_exception, "String could not be parsed as XML", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
sxe->iter.nsprefix = ns_len ? (xmlChar*)estrdup(ns) : NULL;
|
||||
|
@ -1541,7 +1541,7 @@ PHP_METHOD(snmp, __construct)
|
||||
break;
|
||||
default:
|
||||
zend_throw_exception(zend_ce_exception, "Unknown SNMP protocol version", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
/* handle re-open of snmp session */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1819,7 +1819,7 @@ SPL_METHOD(Array, unserialize)
|
||||
outexcept:
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset " ZEND_LONG_FMT " of %zd bytes", (zend_long)((char*)p - buf), buf_len);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
|
||||
} /* }}} */
|
||||
|
||||
@ -1874,7 +1874,7 @@ SPL_METHOD(Array, __unserialize)
|
||||
Z_TYPE_P(flags_zv) != IS_LONG || Z_TYPE_P(members_zv) != IS_ARRAY) {
|
||||
zend_throw_exception(spl_ce_UnexpectedValueException,
|
||||
"Incomplete or ill-typed serialization data", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
flags = Z_LVAL_P(flags_zv);
|
||||
|
@ -853,7 +853,7 @@ SPL_METHOD(DirectoryIterator, seek)
|
||||
zval_ptr_dtor(&retval);
|
||||
if (!valid) {
|
||||
zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Seek position " ZEND_LONG_FMT " is out of range", pos);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next, "next", NULL);
|
||||
}
|
||||
@ -2357,7 +2357,7 @@ SPL_METHOD(SplFileObject, eof)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
RETURN_BOOL(php_stream_eof(intern->u.file.stream));
|
||||
@ -2395,7 +2395,7 @@ SPL_METHOD(SplFileObject, fgets)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (spl_filesystem_file_read(intern, 0) == FAILURE) {
|
||||
@ -2416,7 +2416,7 @@ SPL_METHOD(SplFileObject, current)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (!intern->u.file.current_line && Z_ISUNDEF(intern->u.file.current_zval)) {
|
||||
@ -2505,7 +2505,7 @@ SPL_METHOD(SplFileObject, setMaxLineLen)
|
||||
|
||||
if (max_len < 0) {
|
||||
zend_throw_exception_ex(spl_ce_DomainException, 0, "Maximum line length must be greater than or equal zero");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
intern->u.file.max_line_len = max_len;
|
||||
@ -2568,7 +2568,7 @@ SPL_METHOD(SplFileObject, fgetcsv)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
switch(ZEND_NUM_ARGS())
|
||||
@ -2750,7 +2750,7 @@ SPL_METHOD(SplFileObject, fflush)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
RETURN_BOOL(!php_stream_flush(intern->u.file.stream));
|
||||
@ -2765,7 +2765,7 @@ SPL_METHOD(SplFileObject, ftell)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
ret = php_stream_tell(intern->u.file.stream);
|
||||
@ -2790,7 +2790,7 @@ SPL_METHOD(SplFileObject, fseek)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
spl_filesystem_file_free_line(intern);
|
||||
@ -2807,7 +2807,7 @@ SPL_METHOD(SplFileObject, fgetc)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
spl_filesystem_file_free_line(intern);
|
||||
@ -2835,7 +2835,7 @@ SPL_METHOD(SplFileObject, fpassthru)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
RETURN_LONG(php_stream_passthru(intern->u.file.stream));
|
||||
@ -2849,7 +2849,7 @@ SPL_METHOD(SplFileObject, fscanf)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
spl_filesystem_file_free_line(intern);
|
||||
@ -2875,7 +2875,7 @@ SPL_METHOD(SplFileObject, fwrite)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (ZEND_NUM_ARGS() > 1) {
|
||||
@ -2909,7 +2909,7 @@ SPL_METHOD(SplFileObject, fread)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (length <= 0) {
|
||||
@ -2942,12 +2942,12 @@ SPL_METHOD(SplFileObject, ftruncate)
|
||||
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (!php_stream_truncate_supported(intern->u.file.stream)) {
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0, "Can't truncate file %s", intern->file_name);
|
||||
RETURN_FALSE;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
RETURN_BOOL(0 == php_stream_truncate_set_size(intern->u.file.stream, size));
|
||||
@ -2965,12 +2965,12 @@ SPL_METHOD(SplFileObject, seek)
|
||||
}
|
||||
if(!intern->u.file.stream) {
|
||||
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (line_pos < 0) {
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0, "Can't seek file %s to negative line " ZEND_LONG_FMT, intern->file_name, line_pos);
|
||||
RETURN_FALSE;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
spl_filesystem_file_rewind(ZEND_THIS, intern);
|
||||
|
@ -601,7 +601,7 @@ SPL_METHOD(SplDoublyLinkedList, pop)
|
||||
|
||||
if (Z_ISUNDEF_P(return_value)) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Can't pop from an empty datastructure", 0);
|
||||
RETURN_NULL();
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -621,7 +621,7 @@ SPL_METHOD(SplDoublyLinkedList, shift)
|
||||
|
||||
if (Z_ISUNDEF_P(return_value)) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Can't shift from an empty datastructure", 0);
|
||||
RETURN_NULL();
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -642,7 +642,7 @@ SPL_METHOD(SplDoublyLinkedList, top)
|
||||
|
||||
if (value == NULL || Z_ISUNDEF_P(value)) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Can't peek at an empty datastructure", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
ZVAL_COPY_DEREF(return_value, value);
|
||||
@ -665,7 +665,7 @@ SPL_METHOD(SplDoublyLinkedList, bottom)
|
||||
|
||||
if (value == NULL || Z_ISUNDEF_P(value)) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Can't peek at an empty datastructure", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
ZVAL_COPY_DEREF(return_value, value);
|
||||
@ -719,7 +719,7 @@ SPL_METHOD(SplDoublyLinkedList, setIteratorMode)
|
||||
if (intern->flags & SPL_DLLIST_IT_FIX
|
||||
&& (intern->flags & SPL_DLLIST_IT_LIFO) != (value & SPL_DLLIST_IT_LIFO)) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
intern->flags = (value & SPL_DLLIST_IT_MASK) | (intern->flags & SPL_DLLIST_IT_FIX);
|
||||
@ -780,7 +780,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetGet)
|
||||
|
||||
if (index < 0 || index >= intern->llist->count) {
|
||||
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO);
|
||||
@ -819,7 +819,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet)
|
||||
|
||||
if (index < 0 || index >= intern->llist->count) {
|
||||
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO);
|
||||
@ -842,7 +842,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet)
|
||||
} else {
|
||||
zval_ptr_dtor(value);
|
||||
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
} /* }}} */
|
||||
@ -867,7 +867,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetUnset)
|
||||
|
||||
if (index < 0 || index >= intern->llist->count) {
|
||||
zend_throw_exception(spl_ce_OutOfRangeException, "Offset out of range", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO);
|
||||
@ -908,7 +908,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetUnset)
|
||||
SPL_LLIST_DELREF(element);
|
||||
} else {
|
||||
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
@ -1210,7 +1210,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
|
||||
error:
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset %zd of %zd bytes", ((char*)p - buf), buf_len);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
|
||||
} /* }}} */
|
||||
|
||||
@ -1264,7 +1264,7 @@ SPL_METHOD(SplDoublyLinkedList, __unserialize) {
|
||||
Z_TYPE_P(members_zv) != IS_ARRAY) {
|
||||
zend_throw_exception(spl_ce_UnexpectedValueException,
|
||||
"Incomplete or ill-typed serialization data", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
intern->flags = (int) Z_LVAL_P(flags_zv);
|
||||
@ -1294,7 +1294,7 @@ SPL_METHOD(SplDoublyLinkedList, add)
|
||||
|
||||
if (index < 0 || index > intern->llist->count) {
|
||||
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
Z_TRY_ADDREF_P(value);
|
||||
|
@ -551,7 +551,7 @@ SPL_METHOD(SplFixedArray, __construct)
|
||||
|
||||
if (size < 0) {
|
||||
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "array size cannot be less than zero");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
intern = Z_SPLFIXEDARRAY_P(object);
|
||||
@ -666,7 +666,7 @@ SPL_METHOD(SplFixedArray, fromArray)
|
||||
ZEND_HASH_FOREACH_KEY(Z_ARRVAL_P(data), num_index, str_index) {
|
||||
if (str_index != NULL || (zend_long)num_index < 0) {
|
||||
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "array must contain only positive integer keys");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (num_index > max_index) {
|
||||
@ -677,7 +677,7 @@ SPL_METHOD(SplFixedArray, fromArray)
|
||||
tmp = max_index + 1;
|
||||
if (tmp <= 0) {
|
||||
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "integer overflow detected");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
spl_fixedarray_init(&array, tmp);
|
||||
|
||||
@ -736,7 +736,7 @@ SPL_METHOD(SplFixedArray, setSize)
|
||||
|
||||
if (size < 0) {
|
||||
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "array size cannot be less than zero");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
intern = Z_SPLFIXEDARRAY_P(object);
|
||||
|
@ -616,7 +616,7 @@ SPL_METHOD(SplHeap, insert)
|
||||
|
||||
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
Z_TRY_ADDREF_P(value);
|
||||
@ -640,12 +640,12 @@ SPL_METHOD(SplHeap, extract)
|
||||
|
||||
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (spl_ptr_heap_delete_top(intern->heap, return_value, ZEND_THIS) == FAILURE) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Can't extract from an empty heap", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -666,7 +666,7 @@ SPL_METHOD(SplPriorityQueue, insert)
|
||||
|
||||
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
ZVAL_COPY(&elem.data, data);
|
||||
@ -693,12 +693,12 @@ SPL_METHOD(SplPriorityQueue, extract)
|
||||
|
||||
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (spl_ptr_heap_delete_top(intern->heap, &elem, ZEND_THIS) == FAILURE) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Can't extract from an empty heap", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
spl_pqueue_extract_helper(return_value, &elem, intern->flags);
|
||||
@ -721,14 +721,14 @@ SPL_METHOD(SplPriorityQueue, top)
|
||||
|
||||
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
elem = spl_ptr_heap_top(intern->heap);
|
||||
|
||||
if (!elem) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Can't peek at an empty heap", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
spl_pqueue_extract_helper(return_value, elem, intern->flags);
|
||||
@ -750,7 +750,7 @@ SPL_METHOD(SplPriorityQueue, setExtractFlags)
|
||||
value &= SPL_PQUEUE_EXTR_MASK;
|
||||
if (!value) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Must specify at least one extract flag", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
intern = Z_SPLHEAP_P(ZEND_THIS);
|
||||
@ -838,14 +838,14 @@ SPL_METHOD(SplHeap, top)
|
||||
|
||||
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
value = spl_ptr_heap_top(intern->heap);
|
||||
|
||||
if (!value) {
|
||||
zend_throw_exception(spl_ce_RuntimeException, "Can't peek at an empty heap", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
ZVAL_COPY_DEREF(return_value, value);
|
||||
|
@ -135,7 +135,7 @@ static inline spl_recursive_it_object *spl_recursive_it_from_obj(zend_object *ob
|
||||
if (it->dit_type == DIT_Unknown) { \
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0, \
|
||||
"The object is in an invalid state as the parent constructor was not called"); \
|
||||
return; \
|
||||
RETURN_THROWS(); \
|
||||
} \
|
||||
(var) = it; \
|
||||
} while (0)
|
||||
@ -155,7 +155,7 @@ static inline spl_recursive_it_object *spl_recursive_it_from_obj(zend_object *ob
|
||||
if(!(object)->iterators) { \
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0, \
|
||||
"The object is in an invalid state as the parent constructor was not called"); \
|
||||
return; \
|
||||
RETURN_THROWS(); \
|
||||
} \
|
||||
(var) = &(object)->iterators[(object)->level].element; \
|
||||
} while (0)
|
||||
@ -717,7 +717,7 @@ SPL_METHOD(RecursiveIteratorIterator, getSubIterator)
|
||||
if(!object->iterators) {
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0,
|
||||
"The object is in an invalid state as the parent constructor was not called");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
value = &object->iterators[level].zobject;
|
||||
@ -856,7 +856,7 @@ SPL_METHOD(RecursiveIteratorIterator, setMaxDepth)
|
||||
}
|
||||
if (max_depth < -1) {
|
||||
zend_throw_exception(spl_ce_OutOfRangeException, "Parameter max_depth must be >= -1", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
} else if (max_depth > INT_MAX) {
|
||||
max_depth = INT_MAX;
|
||||
}
|
||||
@ -1106,7 +1106,7 @@ SPL_METHOD(RecursiveTreeIterator, setPrefixPart)
|
||||
|
||||
if (0 > part || part > 5) {
|
||||
zend_throw_exception_ex(spl_ce_OutOfRangeException, 0, "Use RecursiveTreeIterator::PREFIX_* constant");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
smart_str_free(&object->prefix[part]);
|
||||
@ -1126,7 +1126,7 @@ SPL_METHOD(RecursiveTreeIterator, getPrefix)
|
||||
if(!object->iterators) {
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0,
|
||||
"The object is in an invalid state as the parent constructor was not called");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
spl_recursive_tree_iterator_get_prefix(object, return_value);
|
||||
@ -1161,7 +1161,7 @@ SPL_METHOD(RecursiveTreeIterator, getEntry)
|
||||
if(!object->iterators) {
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0,
|
||||
"The object is in an invalid state as the parent constructor was not called");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
spl_recursive_tree_iterator_get_entry(object, return_value);
|
||||
@ -1180,7 +1180,7 @@ SPL_METHOD(RecursiveTreeIterator, getPostfix)
|
||||
if(!object->iterators) {
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0,
|
||||
"The object is in an invalid state as the parent constructor was not called");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
spl_recursive_tree_iterator_get_postfix(object, return_value);
|
||||
@ -1202,7 +1202,7 @@ SPL_METHOD(RecursiveTreeIterator, current)
|
||||
if(!object->iterators) {
|
||||
zend_throw_exception_ex(spl_ce_LogicException, 0,
|
||||
"The object is in an invalid state as the parent constructor was not called");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (object->flags & RTIT_BYPASS_CURRENT) {
|
||||
@ -1365,7 +1365,7 @@ static zend_function *spl_dual_it_get_method(zend_object **object, zend_string *
|
||||
if (intern->dit_type == DIT_Unknown) { \
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Classes derived from %s must call %s::__construct()", \
|
||||
ZSTR_VAL((spl_ce_##classname)->name), ZSTR_VAL((spl_ce_##classname)->name)); \
|
||||
return; \
|
||||
RETURN_THROWS(); \
|
||||
}
|
||||
|
||||
#define APPENDIT_CHECK_CTOR(intern) SPL_CHECK_CTOR(intern, AppendIterator)
|
||||
@ -2087,7 +2087,7 @@ SPL_METHOD(RegexIterator, setMode)
|
||||
|
||||
if (mode < 0 || mode >= REGIT_MODE_MAX) {
|
||||
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Illegal mode " ZEND_LONG_FMT, mode);
|
||||
return;/* NULL */
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
|
||||
@ -2718,7 +2718,7 @@ SPL_METHOD(CachingIterator, __toString)
|
||||
|
||||
if (!(intern->u.caching.flags & (CIT_CALL_TOSTRING|CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT|CIT_TOSTRING_USE_INNER))) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not fetch string value (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) {
|
||||
ZVAL_COPY(return_value, &intern->current.key);
|
||||
@ -2748,7 +2748,7 @@ SPL_METHOD(CachingIterator, offsetSet)
|
||||
|
||||
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &key, &value) == FAILURE) {
|
||||
@ -2772,7 +2772,7 @@ SPL_METHOD(CachingIterator, offsetGet)
|
||||
|
||||
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
|
||||
@ -2799,7 +2799,7 @@ SPL_METHOD(CachingIterator, offsetUnset)
|
||||
|
||||
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
|
||||
@ -2821,7 +2821,7 @@ SPL_METHOD(CachingIterator, offsetExists)
|
||||
|
||||
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
|
||||
@ -2846,7 +2846,7 @@ SPL_METHOD(CachingIterator, getCache)
|
||||
|
||||
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
ZVAL_COPY(return_value, &intern->u.caching.zcache);
|
||||
@ -2884,15 +2884,15 @@ SPL_METHOD(CachingIterator, setFlags)
|
||||
|
||||
if (spl_cit_check_flags(flags) != SUCCESS) {
|
||||
zend_throw_exception(spl_ce_InvalidArgumentException , "Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
if ((intern->u.caching.flags & CIT_CALL_TOSTRING) != 0 && (flags & CIT_CALL_TOSTRING) == 0) {
|
||||
zend_throw_exception(spl_ce_InvalidArgumentException, "Unsetting flag CALL_TO_STRING is not possible", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
if ((intern->u.caching.flags & CIT_TOSTRING_USE_INNER) != 0 && (flags & CIT_TOSTRING_USE_INNER) == 0) {
|
||||
zend_throw_exception(spl_ce_InvalidArgumentException, "Unsetting flag TOSTRING_USE_INNER is not possible", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
if ((flags & CIT_FULL_CACHE) != 0 && (intern->u.caching.flags & CIT_FULL_CACHE) == 0) {
|
||||
/* clear on (re)enable */
|
||||
@ -2916,7 +2916,7 @@ SPL_METHOD(CachingIterator, count)
|
||||
|
||||
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
RETURN_LONG(zend_hash_num_elements(Z_ARRVAL(intern->u.caching.zcache)));
|
||||
|
@ -866,7 +866,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
|
||||
outexcept:
|
||||
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset %zd of %zd bytes", ((char*)p - buf), buf_len);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
|
||||
} /* }}} */
|
||||
|
||||
@ -916,12 +916,12 @@ SPL_METHOD(SplObjectStorage, __unserialize)
|
||||
Z_TYPE_P(storage_zv) != IS_ARRAY || Z_TYPE_P(members_zv) != IS_ARRAY) {
|
||||
zend_throw_exception(spl_ce_UnexpectedValueException,
|
||||
"Incomplete or ill-typed serialization data", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (zend_hash_num_elements(Z_ARRVAL_P(storage_zv)) % 2 != 0) {
|
||||
zend_throw_exception(spl_ce_UnexpectedValueException, "Odd number of elements", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
key = NULL;
|
||||
@ -929,7 +929,7 @@ SPL_METHOD(SplObjectStorage, __unserialize)
|
||||
if (key) {
|
||||
if (Z_TYPE_P(key) != IS_OBJECT) {
|
||||
zend_throw_exception(spl_ce_UnexpectedValueException, "Non-object key", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
spl_object_storage_attach(intern, key, val);
|
||||
@ -1071,14 +1071,14 @@ SPL_METHOD(MultipleIterator, attachIterator)
|
||||
|
||||
if (Z_TYPE_P(info) != IS_LONG && Z_TYPE_P(info) != IS_STRING) {
|
||||
zend_throw_exception(spl_ce_InvalidArgumentException, "Info must be NULL, integer or string", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
|
||||
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL) {
|
||||
if (fast_is_identical_function(info, &element->inf)) {
|
||||
zend_throw_exception(spl_ce_InvalidArgumentException, "Key duplication error", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
zend_hash_move_forward_ex(&intern->storage, &intern->pos);
|
||||
}
|
||||
|
@ -113,20 +113,20 @@ PHP_METHOD(sqlite3, open)
|
||||
|
||||
if (db_obj->initialised) {
|
||||
zend_throw_exception(zend_ce_exception, "Already initialised DB Object", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (filename_len != 0 && (filename_len != sizeof(":memory:")-1 ||
|
||||
memcmp(filename, ":memory:", sizeof(":memory:")-1) != 0)) {
|
||||
if (!(fullpath = expand_filepath(filename, NULL))) {
|
||||
zend_throw_exception(zend_ce_exception, "Unable to expand filepath", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (php_check_open_basedir(fullpath)) {
|
||||
zend_throw_exception_ex(zend_ce_exception, 0, "open_basedir prohibits opening %s", fullpath);
|
||||
efree(fullpath);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
} else {
|
||||
/* filename equals "" or ":memory:" */
|
||||
@ -153,7 +153,7 @@ PHP_METHOD(sqlite3, open)
|
||||
if (sqlite3_key(db_obj->db, encryption_key, encryption_key_len) != SQLITE_OK) {
|
||||
sqlite3_close(db_obj->db);
|
||||
zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", sqlite3_errmsg(db_obj->db));
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -4711,7 +4711,7 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa
|
||||
|
||||
if (argc < req_args) {
|
||||
zend_argument_count_error("At least %d parameters are required, %d given", req_args, argc);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &argc, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) {
|
||||
@ -4805,7 +4805,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
|
||||
|
||||
if (ZEND_NUM_ARGS() < req_args) {
|
||||
zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache) == FAILURE) {
|
||||
@ -4857,7 +4857,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
|
||||
|
||||
if (ZEND_NUM_ARGS() < req_args) {
|
||||
zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache, &fci2, &fci2_cache) == FAILURE) {
|
||||
@ -5104,7 +5104,7 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty
|
||||
if (data_compare_type == DIFF_COMP_DATA_USER) {
|
||||
if (argc < 3) {
|
||||
zend_argument_count_error("At least 3 parameters are required, %d given", ZEND_NUM_ARGS());
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "+f", &args, &argc, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
@ -5113,7 +5113,7 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty
|
||||
} else {
|
||||
if (argc < 2) {
|
||||
zend_argument_count_error("At least 2 parameters are required, %d given", ZEND_NUM_ARGS());
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
@ -5210,7 +5210,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
|
||||
|
||||
if (ZEND_NUM_ARGS() < req_args) {
|
||||
zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache) == FAILURE) {
|
||||
@ -5262,7 +5262,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
|
||||
|
||||
if (ZEND_NUM_ARGS() < req_args) {
|
||||
zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache, &fci2, &fci2_cache) == FAILURE) {
|
||||
@ -5459,7 +5459,7 @@ PHP_FUNCTION(array_diff)
|
||||
|
||||
if (ZEND_NUM_ARGS() < 2) {
|
||||
zend_argument_count_error("At least 2 parameters are required, %d given", ZEND_NUM_ARGS());
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(1, -1)
|
||||
|
@ -1236,12 +1236,12 @@ PHP_FUNCTION(intdiv)
|
||||
|
||||
if (divisor == 0) {
|
||||
zend_throw_exception_ex(zend_ce_division_by_zero_error, 0, "Division by zero");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
} else if (divisor == -1 && dividend == ZEND_LONG_MIN) {
|
||||
/* Prevent overflow error/crash ... really should not happen:
|
||||
We don't return a float here as that violates function contract */
|
||||
zend_throw_exception_ex(zend_ce_arithmetic_error, 0, "Division of PHP_INT_MIN by -1 is not an integer");
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
RETURN_LONG(dividend / divisor);
|
||||
|
@ -206,7 +206,7 @@ PHP_FUNCTION(random_bytes)
|
||||
|
||||
if (size < 1) {
|
||||
zend_throw_exception(zend_ce_error, "Length must be greater than 0", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
bytes = zend_string_alloc(size, 0);
|
||||
@ -281,11 +281,11 @@ PHP_FUNCTION(random_int)
|
||||
|
||||
if (min > max) {
|
||||
zend_throw_exception(zend_ce_error, "Minimum value must be less than or equal to the maximum value", 0);
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (php_random_int_throw(min, max, &result) == FAILURE) {
|
||||
return;
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
RETURN_LONG(result);
|
||||
|
Loading…
Reference in New Issue
Block a user