summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/tests/generators/throw_not_an_exception.phpt7
-rw-r--r--Zend/zend_closures.c31
-rw-r--r--Zend/zend_closures.stub.php17
-rw-r--r--Zend/zend_closures_arginfo.h24
-rw-r--r--Zend/zend_exceptions.c61
-rw-r--r--Zend/zend_exceptions.stub.php68
-rw-r--r--Zend/zend_exceptions_arginfo.h55
-rw-r--r--Zend/zend_generators.c30
-rw-r--r--Zend/zend_generators.stub.php20
-rw-r--r--Zend/zend_generators_arginfo.h22
-rw-r--r--Zend/zend_interfaces.c47
-rw-r--r--Zend/zend_interfaces.stub.php51
-rw-r--r--Zend/zend_interfaces_arginfo.h35
-rw-r--r--ext/standard/tests/serialize/bug69152.phpt8
-rw-r--r--sapi/cli/tests/005.phpt38
15 files changed, 386 insertions, 128 deletions
diff --git a/Zend/tests/generators/throw_not_an_exception.phpt b/Zend/tests/generators/throw_not_an_exception.phpt
index 920d8eb847..abf9a3c894 100644
--- a/Zend/tests/generators/throw_not_an_exception.phpt
+++ b/Zend/tests/generators/throw_not_an_exception.phpt
@@ -12,9 +12,8 @@ $gen->throw(new stdClass);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot throw objects that do not implement Throwable in %s:%d
+Fatal error: Uncaught TypeError: Generator::throw() expects parameter 1 to be Throwable, object given in %s:%d
Stack trace:
-#0 [internal function]: gen()
-#1 %s(%d): Generator->throw(Object(stdClass))
-#2 {main}
+#0 %s(%d): Generator->throw(Object(stdClass))
+#1 {main}
thrown in %s on line %d
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index f5d692ad32..26184d3d35 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -26,6 +26,7 @@
#include "zend_objects.h"
#include "zend_objects_API.h"
#include "zend_globals.h"
+#include "zend_closures_arginfo.h"
#define ZEND_CLOSURE_PRINT_NAME "Closure object"
@@ -591,32 +592,12 @@ ZEND_COLD ZEND_METHOD(Closure, __construct)
}
/* }}} */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_bindto, 0, 0, 1)
- ZEND_ARG_INFO(0, newthis)
- ZEND_ARG_INFO(0, newscope)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_bind, 0, 0, 2)
- ZEND_ARG_INFO(0, closure)
- ZEND_ARG_INFO(0, newthis)
- ZEND_ARG_INFO(0, newscope)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_call, 0, 0, 1)
- ZEND_ARG_INFO(0, newthis)
- ZEND_ARG_VARIADIC_INFO(0, parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_fromcallable, 0, 0, 1)
- ZEND_ARG_INFO(0, callable)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry closure_functions[] = {
- ZEND_ME(Closure, __construct, NULL, ZEND_ACC_PRIVATE)
- ZEND_ME(Closure, bind, arginfo_closure_bind, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_MALIAS(Closure, bindTo, bind, arginfo_closure_bindto, ZEND_ACC_PUBLIC)
- ZEND_ME(Closure, call, arginfo_closure_call, ZEND_ACC_PUBLIC)
- ZEND_ME(Closure, fromCallable, arginfo_closure_fromcallable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(Closure, __construct, arginfo_class_Closure___construct, ZEND_ACC_PRIVATE)
+ ZEND_ME(Closure, bind, arginfo_class_Closure_bind, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_MALIAS(Closure, bindTo, bind, arginfo_class_Closure_bindTo, ZEND_ACC_PUBLIC)
+ ZEND_ME(Closure, call, arginfo_class_Closure_call, ZEND_ACC_PUBLIC)
+ ZEND_ME(Closure, fromCallable, arginfo_class_Closure_fromCallable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_FE_END
};
diff --git a/Zend/zend_closures.stub.php b/Zend/zend_closures.stub.php
new file mode 100644
index 0000000000..cc859b2b10
--- /dev/null
+++ b/Zend/zend_closures.stub.php
@@ -0,0 +1,17 @@
+<?php
+
+Class Closure
+{
+ private function __construct() {}
+
+ /** @return ?Closure */
+ static function bind(Closure $closure, ?object $newthis, $newscope = UNKNOWN) {}
+
+ /** @return ?Closure */
+ function bindTo(?object $newthis, $newscope = UNKNOWN) {}
+
+ function call(object $newthis, ...$parameters) {}
+
+ /** @return Closure */
+ function fromCallable(callable $callable) {}
+}
diff --git a/Zend/zend_closures_arginfo.h b/Zend/zend_closures_arginfo.h
new file mode 100644
index 0000000000..91d019dc94
--- /dev/null
+++ b/Zend/zend_closures_arginfo.h
@@ -0,0 +1,24 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_bind, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, closure, Closure, 0)
+ ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 1)
+ ZEND_ARG_INFO(0, newscope)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_bindTo, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 1)
+ ZEND_ARG_INFO(0, newscope)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_call, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 0)
+ ZEND_ARG_VARIADIC_INFO(0, parameters)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_fromCallable, 0, 0, 1)
+ ZEND_ARG_INFO(0, callable)
+ZEND_END_ARG_INFO()
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 6dfb374c2c..eb248b1ff2 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -27,6 +27,7 @@
#include "zend_vm.h"
#include "zend_dtrace.h"
#include "zend_smart_str.h"
+#include "zend_exceptions_arginfo.h"
ZEND_API zend_class_entry *zend_ce_throwable;
ZEND_API zend_class_entry *zend_ce_exception;
@@ -631,7 +632,8 @@ ZEND_METHOD(exception, getTraceAsString)
trace = zend_read_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_TRACE), 1, &rv);
if (Z_TYPE_P(trace) != IS_ARRAY) {
- RETURN_FALSE;
+ zend_type_error("trace is not an array");
+ return;
}
ZEND_HASH_FOREACH_NUM_KEY_VAL(Z_ARRVAL_P(trace), index, frame) {
if (Z_TYPE_P(frame) != IS_ARRAY) {
@@ -759,14 +761,14 @@ ZEND_METHOD(exception, __toString)
/** {{{ Throwable method definition */
static const zend_function_entry zend_funcs_throwable[] = {
- ZEND_ABSTRACT_ME(throwable, getMessage, NULL)
- ZEND_ABSTRACT_ME(throwable, getCode, NULL)
- ZEND_ABSTRACT_ME(throwable, getFile, NULL)
- ZEND_ABSTRACT_ME(throwable, getLine, NULL)
- ZEND_ABSTRACT_ME(throwable, getTrace, NULL)
- ZEND_ABSTRACT_ME(throwable, getPrevious, NULL)
- ZEND_ABSTRACT_ME(throwable, getTraceAsString, NULL)
- ZEND_ABSTRACT_ME(throwable, __toString, NULL)
+ ZEND_ABSTRACT_ME(throwable, getMessage, arginfo_class_Throwable_getMessage)
+ ZEND_ABSTRACT_ME(throwable, getCode, arginfo_class_Throwable_getCode)
+ ZEND_ABSTRACT_ME(throwable, getFile, arginfo_class_Throwable_getFile)
+ ZEND_ABSTRACT_ME(throwable, getLine, arginfo_class_Throwable_getLine)
+ ZEND_ABSTRACT_ME(throwable, getTrace, arginfo_class_Throwable_getTrace)
+ ZEND_ABSTRACT_ME(throwable, getPrevious, arginfo_class_Throwable_getPrevious)
+ ZEND_ABSTRACT_ME(throwable, getTraceAsString, arginfo_class_Throwable_getTraceAsString)
+ ZEND_ABSTRACT_ME(throwable, __toString, arginfo_class_Throwable___toString)
ZEND_FE_END
};
/* }}} */
@@ -781,39 +783,24 @@ static const zend_function_entry zend_funcs_throwable[] = {
* And never try to change the state of exceptions and never implement anything
* that gives the user anything to accomplish this.
*/
-ZEND_BEGIN_ARG_INFO_EX(arginfo_exception___construct, 0, 0, 0)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, code)
- ZEND_ARG_INFO(0, previous)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry default_exception_functions[] = {
- ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
- ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC)
- ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getLine, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getTrace, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getPrevious, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getTraceAsString, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, __toString, NULL, 0)
+ ZEND_ME(exception, __clone, arginfo_class_Exception___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(exception, __construct, arginfo_class_Exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, arginfo_class_Exception___wakeup, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, getMessage, arginfo_class_Exception_getMessage, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getCode, arginfo_class_Exception_getCode, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getFile, arginfo_class_Exception_getFile, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getLine, arginfo_class_Exception_getLine, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getTrace, arginfo_class_Exception_getTrace, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getPrevious, arginfo_class_Exception_getPrevious, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getTraceAsString, arginfo_class_Exception_getTraceAsString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, __toString, arginfo_class_Exception___toString, 0)
ZEND_FE_END
};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_error_exception___construct, 0, 0, 0)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, code)
- ZEND_ARG_INFO(0, severity)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, lineno)
- ZEND_ARG_INFO(0, previous)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry error_exception_functions[] = {
- ZEND_ME(error_exception, __construct, arginfo_error_exception___construct, ZEND_ACC_PUBLIC)
- ZEND_ME(error_exception, getSeverity, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(error_exception, __construct, arginfo_class_ErrorException___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(error_exception, getSeverity, arginfo_class_ErrorException_getSeverity, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_FE_END
};
/* }}} */
diff --git a/Zend/zend_exceptions.stub.php b/Zend/zend_exceptions.stub.php
new file mode 100644
index 0000000000..96d581caf9
--- /dev/null
+++ b/Zend/zend_exceptions.stub.php
@@ -0,0 +1,68 @@
+<?php
+
+interface Throwable
+{
+ /** @return string */
+ function getMessage();
+
+ /** @return int */
+ function getCode();
+
+ /** @return string */
+ function getFile();
+
+ /** @return int */
+ function getLine();
+
+ /** @return array */
+ function getTrace();
+
+ /** @return ?Throwable */
+ function getPrevious();
+
+ /** @return string */
+ function getTraceAsString();
+
+ /** @return string */
+ function __toString();
+}
+
+class Exception implements Throwable
+{
+ final private function __clone() {}
+
+ function __construct(string $message = UNKNOWN, int $code = 0, ?Throwable $previous = null) {}
+
+ function __wakeup() {}
+
+ /** @return string */
+ final function getMessage() {}
+
+ /** @return int */
+ final function getCode() {}
+
+ /** @return string */
+ final function getFile() {}
+
+ /** @return int */
+ final function getLine() {}
+
+ /** @return array */
+ final function getTrace() {}
+
+ /** @return ?Throwable */
+ final function getPrevious() {}
+
+ /** @return string */
+ final function getTraceAsString() {}
+
+ /** @return string */
+ function __toString() {}
+}
+
+class ErrorException extends Exception
+{
+ function __construct(string $message = UNKNOWN, int $code = 0, int $severity = E_ERROR, string $filename = UNKNOWN, int $lineno = 0, ?Throwable $previous = null) {}
+
+ final function getSeverity() {}
+}
diff --git a/Zend/zend_exceptions_arginfo.h b/Zend/zend_exceptions_arginfo.h
new file mode 100644
index 0000000000..c2f83e47e5
--- /dev/null
+++ b/Zend/zend_exceptions_arginfo.h
@@ -0,0 +1,55 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Throwable_getMessage, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Throwable_getCode arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getFile arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getLine arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getTrace arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getPrevious arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getTraceAsString arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable___toString arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception___clone arginfo_class_Throwable_getMessage
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Exception___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, code, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, previous, Throwable, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Exception___wakeup arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getMessage arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getCode arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getFile arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getLine arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getTrace arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getPrevious arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getTraceAsString arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception___toString arginfo_class_Throwable_getMessage
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ErrorException___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, code, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, severity, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, lineno, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, previous, Throwable, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ErrorException_getSeverity arginfo_class_Throwable_getMessage
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index d8e61fffef..432c1198d9 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -23,6 +23,7 @@
#include "zend_exceptions.h"
#include "zend_generators.h"
#include "zend_closures.h"
+#include "zend_generators_arginfo.h"
ZEND_API zend_class_entry *zend_ce_generator;
ZEND_API zend_class_entry *zend_ce_ClosedGeneratorException;
@@ -1007,7 +1008,7 @@ ZEND_METHOD(Generator, throw)
zend_generator *generator;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(exception)
+ Z_PARAM_OBJECT_OF_CLASS(exception, zend_ce_throwable);
ZEND_PARSE_PARAMETERS_END();
Z_TRY_ADDREF_P(exception);
@@ -1172,26 +1173,15 @@ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *ob
}
/* }}} */
-ZEND_BEGIN_ARG_INFO(arginfo_generator_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_generator_send, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_generator_throw, 0, 0, 1)
- ZEND_ARG_INFO(0, exception)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry generator_functions[] = {
- ZEND_ME(Generator, rewind, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, valid, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, current, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, key, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, next, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, send, arginfo_generator_send, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, throw, arginfo_generator_throw, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, getReturn,arginfo_generator_void, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, rewind, arginfo_class_Generator_rewind, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, valid, arginfo_class_Generator_valid, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, current, arginfo_class_Generator_current, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, key, arginfo_class_Generator_key, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, next, arginfo_class_Generator_next, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, send, arginfo_class_Generator_send, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, throw, arginfo_class_Generator_throw, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, getReturn,arginfo_class_Generator_getReturn, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
diff --git a/Zend/zend_generators.stub.php b/Zend/zend_generators.stub.php
new file mode 100644
index 0000000000..759bd4cd48
--- /dev/null
+++ b/Zend/zend_generators.stub.php
@@ -0,0 +1,20 @@
+<?php
+
+final class Generator implements Iterator
+{
+ function rewind(): void {}
+
+ function valid(): bool {}
+
+ function current() {}
+
+ function key() {}
+
+ function next(): void {}
+
+ function send($value) {}
+
+ function throw(Throwable $exception) {}
+
+ function getReturn() {}
+}
diff --git a/Zend/zend_generators_arginfo.h b/Zend/zend_generators_arginfo.h
new file mode 100644
index 0000000000..56d4ddeccf
--- /dev/null
+++ b/Zend/zend_generators_arginfo.h
@@ -0,0 +1,22 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_rewind, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Generator_valid arginfo_class_Generator_rewind
+
+#define arginfo_class_Generator_current arginfo_class_Generator_rewind
+
+#define arginfo_class_Generator_key arginfo_class_Generator_rewind
+
+#define arginfo_class_Generator_next arginfo_class_Generator_rewind
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_send, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_throw, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, exception, Throwable, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Generator_getReturn arginfo_class_Generator_rewind
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c
index da8f4aae60..5d58b3e178 100644
--- a/Zend/zend_interfaces.c
+++ b/Zend/zend_interfaces.c
@@ -20,6 +20,7 @@
#include "zend_API.h"
#include "zend_interfaces.h"
#include "zend_exceptions.h"
+#include "zend_interfaces_arginfo.h"
ZEND_API zend_class_entry *zend_ce_traversable;
ZEND_API zend_class_entry *zend_ce_aggregate;
@@ -533,57 +534,37 @@ static int zend_implement_countable(zend_class_entry *interface, zend_class_entr
/* {{{ function tables */
static const zend_function_entry zend_funcs_aggregate[] = {
- ZEND_ABSTRACT_ME(iterator, getIterator, NULL)
+ ZEND_ABSTRACT_ME(iterator, getIterator, arginfo_class_IteratorAggregate_getIterator)
ZEND_FE_END
};
static const zend_function_entry zend_funcs_iterator[] = {
- ZEND_ABSTRACT_ME(iterator, current, NULL)
- ZEND_ABSTRACT_ME(iterator, next, NULL)
- ZEND_ABSTRACT_ME(iterator, key, NULL)
- ZEND_ABSTRACT_ME(iterator, valid, NULL)
- ZEND_ABSTRACT_ME(iterator, rewind, NULL)
+ ZEND_ABSTRACT_ME(iterator, current, arginfo_class_Iterator_current)
+ ZEND_ABSTRACT_ME(iterator, next, arginfo_class_Iterator_next)
+ ZEND_ABSTRACT_ME(iterator, key, arginfo_class_Iterator_key)
+ ZEND_ABSTRACT_ME(iterator, valid, arginfo_class_Iterator_valid)
+ ZEND_ABSTRACT_ME(iterator, rewind, arginfo_class_Iterator_rewind)
ZEND_FE_END
};
static const zend_function_entry *zend_funcs_traversable = NULL;
-ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset, 0, 0, 1)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset_get, 0, 0, 1) /* actually this should be return by ref but atm cannot be */
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset_value, 0, 0, 2)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry zend_funcs_arrayaccess[] = {
- ZEND_ABSTRACT_ME(arrayaccess, offsetExists, arginfo_arrayaccess_offset)
- ZEND_ABSTRACT_ME(arrayaccess, offsetGet, arginfo_arrayaccess_offset_get)
- ZEND_ABSTRACT_ME(arrayaccess, offsetSet, arginfo_arrayaccess_offset_value)
- ZEND_ABSTRACT_ME(arrayaccess, offsetUnset, arginfo_arrayaccess_offset)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetExists, arginfo_class_ArrayAccess_offsetExists)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetGet, arginfo_class_ArrayAccess_offsetGet)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetSet, arginfo_class_ArrayAccess_offsetSet)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetUnset, arginfo_class_ArrayAccess_offsetUnset)
ZEND_FE_END
};
-ZEND_BEGIN_ARG_INFO(arginfo_serializable_serialize, 0)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry zend_funcs_serializable[] = {
- ZEND_ABSTRACT_ME(serializable, serialize, NULL)
- ZEND_FENTRY(unserialize, NULL, arginfo_serializable_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_ABSTRACT_ME(serializable, serialize, arginfo_class_Serializable_serialize)
+ ZEND_FENTRY(unserialize, NULL, arginfo_class_Serializable_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
ZEND_FE_END
};
-ZEND_BEGIN_ARG_INFO(arginfo_countable_count, 0)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry zend_funcs_countable[] = {
- ZEND_ABSTRACT_ME(Countable, count, arginfo_countable_count)
+ ZEND_ABSTRACT_ME(Countable, count, arginfo_class_Countable_count)
ZEND_FE_END
};
/* }}} */
diff --git a/Zend/zend_interfaces.stub.php b/Zend/zend_interfaces.stub.php
new file mode 100644
index 0000000000..882a21e600
--- /dev/null
+++ b/Zend/zend_interfaces.stub.php
@@ -0,0 +1,51 @@
+<?php
+
+interface Traversable {}
+
+interface IteratorAggregate extends Traversable
+{
+ /** @return Traversable */
+ function getIterator();
+}
+
+interface Iterator extends Traversable
+{
+ function current();
+
+ /** @return void */
+ function next();
+
+ function key();
+
+ /** @return bool */
+ function valid();
+
+ /** @return void */
+ function rewind();
+}
+
+interface ArrayAccess
+{
+ function offsetExists($offset);
+
+ /* actually this should be return by ref but atm cannot be */
+ function offsetGet($offset);
+
+ function offsetSet($offset, $value);
+
+ function offsetUnset($offset);
+}
+
+interface Serializable
+{
+ /** @return string */
+ function serialize();
+
+ function unserialize(string $serialized);
+}
+
+interface Countable
+{
+ /** @return int */
+ function count();
+}
diff --git a/Zend/zend_interfaces_arginfo.h b/Zend/zend_interfaces_arginfo.h
new file mode 100644
index 0000000000..fee57057af
--- /dev/null
+++ b/Zend/zend_interfaces_arginfo.h
@@ -0,0 +1,35 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IteratorAggregate_getIterator, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Iterator_current arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_next arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_key arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_valid arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_rewind arginfo_class_IteratorAggregate_getIterator
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayAccess_offsetExists, 0, 0, 1)
+ ZEND_ARG_INFO(0, offset)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ArrayAccess_offsetGet arginfo_class_ArrayAccess_offsetExists
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayAccess_offsetSet, 0, 0, 2)
+ ZEND_ARG_INFO(0, offset)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ArrayAccess_offsetUnset arginfo_class_ArrayAccess_offsetExists
+
+#define arginfo_class_Serializable_serialize arginfo_class_IteratorAggregate_getIterator
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Serializable_unserialize, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Countable_count arginfo_class_IteratorAggregate_getIterator
diff --git a/ext/standard/tests/serialize/bug69152.phpt b/ext/standard/tests/serialize/bug69152.phpt
index c4dbcd6926..abd0281a12 100644
--- a/ext/standard/tests/serialize/bug69152.phpt
+++ b/ext/standard/tests/serialize/bug69152.phpt
@@ -9,8 +9,6 @@ $x->test();
?>
--EXPECTF--
-Exception in %s:%d
-Stack trace:
-#0 {main}
-
-Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
+Fatal error: Uncaught TypeError: trace is not an array in %s:%d
+%a
+ thrown in %s on line %d
diff --git a/sapi/cli/tests/005.phpt b/sapi/cli/tests/005.phpt
index 0a366b6975..d268104606 100644
--- a/sapi/cli/tests/005.phpt
+++ b/sapi/cli/tests/005.phpt
@@ -37,7 +37,7 @@ string(183) "Class [ <internal:Core> class stdClass ] {
}
"
-string(1607) "Class [ <internal:Core> class Exception implements Throwable ] {
+string(1969) "Class [ <internal:Core> class Exception implements Throwable ] {
- Constants [0] {
}
@@ -60,42 +60,72 @@ string(1607) "Class [ <internal:Core> class Exception implements Throwable ] {
- Methods [11] {
Method [ <internal:Core> final private method __clone ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, ctor> public method __construct ] {
- Parameters [3] {
- Parameter #0 [ <optional> $message ]
- Parameter #1 [ <optional> $code ]
- Parameter #2 [ <optional> $previous ]
+ Parameter #0 [ <optional> string $message ]
+ Parameter #1 [ <optional> int $code ]
+ Parameter #2 [ <optional> ?Throwable $previous ]
}
}
Method [ <internal:Core> public method __wakeup ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getMessage ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getCode ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getFile ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getLine ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getTrace ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getPrevious ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getTraceAsString ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> public method __toString ] {
+
+ - Parameters [0] {
+ }
}
}
}