Skip to content

Commit

Permalink
Merge branch 'PHP-7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoebi committed Aug 23, 2016
2 parents 7edaed6 + f4e68a3 commit 600bf56
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
12 changes: 11 additions & 1 deletion ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -3028,13 +3028,23 @@ ZEND_METHOD(reflection_type, __toString)
{
reflection_object *intern;
type_reference *param;
zend_string *str;

if (zend_parse_parameters_none() == FAILURE) {
return;
}
GET_REFLECTION_OBJECT_PTR(param);

RETURN_STR(reflection_type_name(param));
str = reflection_type_name(param);

if (param->arg_info->allow_null) {
size_t orig_len = ZSTR_LEN(str);
str = zend_string_extend(str, orig_len + 1, 0);
memmove(ZSTR_VAL(str) + 1, ZSTR_VAL(str), orig_len + 1);
ZSTR_VAL(str)[0] = '?';
}

RETURN_STR(str);
}
/* }}} */

Expand Down
8 changes: 4 additions & 4 deletions ext/reflection/tests/ReflectionNamedType.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ var_dump((string) $return);
?>
--EXPECTF--
string(11) "Traversable"
string(11) "Traversable"
string(6) "string"
string(12) "?Traversable"
string(6) "string"
string(7) "?string"
string(4) "Test"
string(5) "?Test"
string(4) "Test"
string(4) "Test"
string(4) "Test"
string(5) "?Test"
4 changes: 3 additions & 1 deletion ext/reflection/tests/ReflectionType_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ foreach ([
var_dump((string)$ra);
}
}

?>
--EXPECT--
*** functions
** Function 0 - Parameter 0
Expand All @@ -94,7 +96,7 @@ string(8) "callable"
bool(true)
bool(true)
bool(false)
string(8) "stdClass"
string(9) "?stdClass"
** Function 0 - Parameter 4
bool(false)
** Function 0 - Parameter 5
Expand Down

0 comments on commit 600bf56

Please sign in to comment.