Skip to content

Commit 27e557a

Browse files
committed
Merge branch 'master' of https://git.php.net/repository/php-src
# By Rasmus Lerdorf (3) and others # Via Rasmus Lerdorf * 'master' of https://git.php.net/repository/php-src: Fix more proto comments prepare NEWS for next Fix more minor mistakes in the proto comments Avoid op_num = -1 in unfinished generator cleanup Fix incorrect protos
2 parents 7464424 + 28d7bb9 commit 27e557a

34 files changed

+164
-126
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Aborted yield during nested calls
3+
--FILE--
4+
<?php
5+
6+
function func() {}
7+
8+
function gen($x) {
9+
func(func($x, $x, func($x, yield)));
10+
}
11+
12+
$gen = gen("x");
13+
$gen->rewind();
14+
15+
?>
16+
===DONE===
17+
--EXPECT--
18+
===DONE===
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
Aborted yield during switch
3+
--FILE--
4+
<?php
5+
6+
function gen($x) {
7+
switch ($x."y") {
8+
default:
9+
yield;
10+
}
11+
}
12+
13+
$gen = gen("x");
14+
$gen->rewind();
15+
16+
?>
17+
===DONE===
18+
--EXPECT--
19+
===DONE===

Zend/zend_builtin_functions.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,8 @@ ZEND_FUNCTION(strncasecmp)
600600
}
601601
/* }}} */
602602

603-
/* {{{ proto array each(array arr)
604-
Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element */
603+
/* {{{ proto mixed each(array &arr)
604+
Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element, or false if there is no element at this place */
605605
ZEND_FUNCTION(each)
606606
{
607607
zval *array, *entry, tmp;
@@ -775,7 +775,7 @@ static void copy_constant_array(zval *dst, zval *src) /* {{{ */
775775
}
776776
/* }}} */
777777

778-
/* {{{ proto bool define(string constant_name, mixed value, boolean case_insensitive=false)
778+
/* {{{ proto bool define(string constant_name, mixed value[, boolean case_insensitive])
779779
Define a new constant */
780780
ZEND_FUNCTION(define)
781781
{
@@ -933,8 +933,8 @@ ZEND_FUNCTION(get_called_class)
933933
}
934934
/* }}} */
935935

936-
/* {{{ proto string get_parent_class([mixed object])
937-
Retrieves the parent class name for object or class or current scope. */
936+
/* {{{ proto mixed get_parent_class([mixed object])
937+
Retrieves the parent class name for object or class or current scope or false if not in a scope. */
938938
ZEND_FUNCTION(get_parent_class)
939939
{
940940
zval *arg;
@@ -1025,15 +1025,15 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) /*
10251025
}
10261026
/* }}} */
10271027

1028-
/* {{{ proto bool is_subclass_of(mixed object_or_string, string class_name [, bool allow_string=true])
1028+
/* {{{ proto bool is_subclass_of(mixed object_or_string, string class_name [, bool allow_string])
10291029
Returns true if the object has this class as one of its parents */
10301030
ZEND_FUNCTION(is_subclass_of)
10311031
{
10321032
is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
10331033
}
10341034
/* }}} */
10351035

1036-
/* {{{ proto bool is_a(mixed object_or_string, string class_name [, bool allow_string=false])
1036+
/* {{{ proto bool is_a(mixed object_or_string, string class_name [, bool allow_string])
10371037
Returns true if the first argument is an object and is this class or has this class as one of its parents, */
10381038
ZEND_FUNCTION(is_a)
10391039
{
@@ -1566,7 +1566,7 @@ ZEND_FUNCTION(class_alias)
15661566
/* }}} */
15671567

15681568
#if ZEND_DEBUG
1569-
/* {{{ proto void leak(int num_bytes=3)
1569+
/* {{{ proto void leak([int num_bytes])
15701570
Cause an intentional memory leak, for testing/debugging purposes */
15711571
ZEND_FUNCTION(leak)
15721572
{
@@ -1670,7 +1670,7 @@ ZEND_FUNCTION(trigger_error)
16701670
}
16711671
/* }}} */
16721672

1673-
/* {{{ proto string set_error_handler(string error_handler [, int error_types])
1673+
/* {{{ proto string set_error_handler(callable error_handler [, int error_types])
16741674
Sets a user-defined error handler function. Returns the previously defined error handler, or false on error */
16751675
ZEND_FUNCTION(set_error_handler)
16761676
{
@@ -1739,8 +1739,8 @@ ZEND_FUNCTION(restore_error_handler)
17391739
}
17401740
/* }}} */
17411741

1742-
/* {{{ proto string set_exception_handler(callable exception_handler)
1743-
Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error */
1742+
/* {{{ proto mixed set_exception_handler(callable exception_handler)
1743+
Sets a user-defined exception handler function. Returns the previously defined exception handler, or false on error */
17441744
ZEND_FUNCTION(set_exception_handler)
17451745
{
17461746
zval *exception_handler;
@@ -2115,7 +2115,7 @@ static int add_constant_info(zval *item, void *arg) /* {{{ */
21152115
}
21162116
/* }}} */
21172117

2118-
/* {{{ proto array get_loaded_extensions([bool zend_extensions]) U
2118+
/* {{{ proto array get_loaded_extensions([bool zend_extensions])
21192119
Return an array containing names of loaded extensions */
21202120
ZEND_FUNCTION(get_loaded_extensions)
21212121
{

Zend/zend_closures.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
6969
}
7070
/* }}} */
7171

72-
/* {{{ proto mixed Closure::call(object $to [, mixed $parameter] [, mixed $...] )
72+
/* {{{ proto mixed Closure::call(object to [, mixed parameter] [, mixed ...] )
7373
Call closure, binding to a given object with its class as the scope */
7474
ZEND_METHOD(Closure, call)
7575
{
@@ -143,7 +143,7 @@ ZEND_METHOD(Closure, call)
143143
}
144144
/* }}} */
145145

146-
/* {{{ proto Closure Closure::bind(Closure $old, object $to [, mixed $scope = "static" ] )
146+
/* {{{ proto Closure Closure::bind(callable old, object to [, mixed scope])
147147
Create a closure from another one and bind to another object and scope */
148148
ZEND_METHOD(Closure, bind)
149149
{

Zend/zend_generators.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ static zend_object *zend_generator_create(zend_class_entry *class_type);
3434
static void zend_generator_cleanup_unfinished_execution(zend_generator *generator) /* {{{ */
3535
{
3636
zend_execute_data *execute_data = generator->execute_data;
37-
/* -1 required because we want the last run opcode, not the next to-be-run one. */
38-
uint32_t op_num = execute_data->opline - execute_data->func->op_array.opcodes - 1;
3937

4038
if (generator->send_target) {
41-
if (Z_REFCOUNTED_P(generator->send_target)) Z_DELREF_P(generator->send_target);
39+
Z_TRY_DELREF_P(generator->send_target);
4240
generator->send_target = NULL;
4341
}
4442

45-
{
43+
if (execute_data->opline != execute_data->func->op_array.opcodes) {
44+
/* -1 required because we want the last run opcode, not the next to-be-run one. */
45+
uint32_t op_num = execute_data->opline - execute_data->func->op_array.opcodes - 1;
46+
4647
/* There may be calls to zend_vm_stack_free_call_frame(), which modifies the VM stack
4748
* globals, so need to load/restore those. */
4849
zend_vm_stack original_stack = EG(vm_stack);
@@ -847,7 +848,7 @@ ZEND_METHOD(Generator, next)
847848
}
848849
/* }}} */
849850

850-
/* {{{ proto mixed Generator::send(mixed $value)
851+
/* {{{ proto mixed Generator::send(mixed value)
851852
* Sends a value to the generator */
852853
ZEND_METHOD(Generator, send)
853854
{
@@ -886,7 +887,7 @@ ZEND_METHOD(Generator, send)
886887
}
887888
/* }}} */
888889

889-
/* {{{ proto mixed Generator::throw(Exception $exception)
890+
/* {{{ proto mixed Generator::throw(Exception exception)
890891
* Throws an exception into the generator */
891892
ZEND_METHOD(Generator, throw)
892893
{

ext/dom/attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const zend_function_entry php_dom_attr_class_functions[] = {
5252
PHP_FE_END
5353
};
5454

55-
/* {{{ proto void DOMAttr::__construct(string name, [string value]); */
55+
/* {{{ proto void DOMAttr::__construct(string name, [string value]) */
5656
PHP_METHOD(domattr, __construct)
5757
{
5858
zval *id = getThis();
@@ -220,7 +220,7 @@ int dom_attr_schema_type_info_read(dom_object *obj, zval *retval)
220220

221221
/* }}} */
222222

223-
/* {{{ proto boolean dom_attr_is_id();
223+
/* {{{ proto boolean dom_attr_is_id()
224224
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-isId
225225
Since: DOM Level 3
226226
*/

0 commit comments

Comments
 (0)