Skip to content

Commit c544ffb

Browse files
committed
Fix tests and get rid of memory leaks
1 parent 663d012 commit c544ffb

7 files changed

+10
-12
lines changed

Zend/zend_execute_API.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,11 @@ ZEND_API zend_string *get_active_function_or_method_name(void) /* {{{ */
511511

512512
ZEND_API zend_string *get_function_or_method_name(const zend_function *func) /* {{{ */
513513
{
514-
const char *name = get_function_name(func);
515-
516514
if (func->common.scope) {
517-
return zend_create_member_string(func->common.scope->name, zend_string_init(name, strlen(name), 1));
515+
return zend_create_member_string(func->common.scope->name, func->common.function_name);
518516
}
519517

520-
return zend_string_init(name, strlen(name), 0);
518+
return func->common.function_name ? zend_string_copy(func->common.function_name) : zend_string_init("main", sizeof("main") - 1, 0);
521519
}
522520
/* }}} */
523521

ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ try {
4747
ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 3 given
4848
ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 0 given
4949
ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 1 given
50-
Class C does not have a property named
50+
Class C does not have a property named
5151
Class C does not have a property named 1.5
5252
ReflectionClass::setStaticPropertyValue(): Argument #1 ($name) must be of type string, array given

ext/reflection/tests/ReflectionExtension_constructor_error.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ try {
2525

2626

2727
?>
28-
--EXPECTF--
29-
Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given
30-
Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given
28+
--EXPECT--
29+
Ok - ReflectionExtension::__construct() expects exactly 1 argument, 0 given
30+
Ok - ReflectionExtension::__construct() expects exactly 1 argument, 2 given
3131
Ok - ReflectionExtension::__construct(): Argument #1 ($name) must be of type string, array given

ext/session/tests/session_set_save_handler_class_012.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i
4242
?>
4343
--EXPECTF--
4444
*** Testing session_set_save_handler() : incorrect arguments for existing handler open ***
45-
Open
45+
Open
4646

4747
Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d
4848
SessionHandler::open() expects exactly 2 arguments, 0 given

ext/session/tests/session_set_save_handler_class_013.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i
3838
?>
3939
--EXPECTF--
4040
*** Testing session_set_save_handler() : incorrect arguments for existing handler close ***
41-
Open
41+
Open
4242
Read %s
4343
string(%d) "%s"
4444
string(5) "files"

ext/spl/tests/arrayObject_uksort_error1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ try {
2222
}
2323
?>
2424
--EXPECT--
25-
ArrayObject::uksort() expects exactly 1 arguments, 0 given
25+
ArrayObject::uksort() expects exactly 1 argument, 0 given
2626
ArrayObject::uksort() expects exactly 1 argument, 2 given

ext/sqlite3/tests/sqlite3_02_open.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ try {
1616

1717
?>
1818
--EXPECT--
19-
string(60) "SQLite3::__construct() expects at least 1 argument, 0 given"
19+
string(59) "SQLite3::__construct() expects at least 1 argument, 0 given"

0 commit comments

Comments
 (0)