summaryrefslogtreecommitdiff
path: root/Zend/zend.c
diff options
context:
space:
mode:
authorPeter Cowburn <salathe@php.net>2019-09-04 21:39:02 +0100
committerPeter Cowburn <salathe@php.net>2019-09-09 21:06:00 +0100
commitbc6199757168eee4bd1d0a0d28a36c242bdcf13d (patch)
tree2d018baed796fd75c1aabdae0d866b01417f5129 /Zend/zend.c
parent628fd6ec7170d03921b0047fd1aaaa8171ad4e8e (diff)
downloadphp-git-bc6199757168eee4bd1d0a0d28a36c242bdcf13d.tar.gz
add ValueError
ValueError is intended to be thrown when a function or method receives an argument that has the right type (incorrect type should throw a TypeError) but an inappropriate value.
Diffstat (limited to 'Zend/zend.c')
-rw-r--r--Zend/zend.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 4338fcb903..4ad04f3876 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -1560,6 +1560,18 @@ ZEND_API ZEND_COLD void zend_argument_count_error(const char *format, ...) /* {{
va_end(va);
} /* }}} */
+ZEND_API ZEND_COLD void zend_value_error(const char *format, ...) /* {{{ */
+{
+ va_list va;
+ char *message = NULL;
+
+ va_start(va, format);
+ zend_vspprintf(&message, 0, format, va);
+ zend_throw_exception(zend_ce_value_error, message, 0);
+ efree(message);
+ va_end(va);
+} /* }}} */
+
ZEND_API ZEND_COLD void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) /* {{{ */
{
#if ZEND_DEBUG