Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix some issues with internal functions

  • Loading branch information...
commit 8795ff9e9efddecb931f7479e77db2ab3af120bf 1 parent 4171c97
@adoy authored
Showing with 28 additions and 1 deletion.
  1. +13 −1 Zend/zend_API.c
  2. +15 −0 ok.php
View
14 Zend/zend_API.c
@@ -841,7 +841,19 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
arg = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (arg_count-i));
- if (zend_parse_arg(i+1, arg, va, &type_spec, quiet TSRMLS_CC) == FAILURE) {
+ if (*arg == NULL) {
+ zend_function *active_function = EG(current_execute_data)->function_state.function;
+ const char *class_name = active_function->common.scope ? active_function->common.scope->name : "";
+ zend_error(E_WARNING, "Argument %d of %s%s%s() is mandatory",
+ i+1,
+ class_name,
+ class_name[0] ? "::" : "",
+ active_function->common.function_name);
+ ALLOC_ZVAL(*arg);
+ Z_SET_REFCOUNT_P(*arg, 0);
+ Z_ADDREF_P(*arg);
+ return FAILURE;
+ } else if (zend_parse_arg(i+1, arg, va, &type_spec, quiet TSRMLS_CC) == FAILURE) {
/* clean up varargs array if it was used */
if (varargs && *varargs) {
efree(*varargs);
View
15 ok.php
@@ -0,0 +1,15 @@
+<?php
+
+function hello($hello = 'Hello', $world = 'World') {
+ echo $hello, ' ', $world, PHP_EOL;
+}
+hello();
+hello(default, 'Pierrick');
+
+function foo($hello)
+{
+}
+foo(default);
+
+strlen(default);
+substr("Pierrick", 1, default);

0 comments on commit 8795ff9

Please sign in to comment.
Something went wrong with that request. Please try again.