Skip to content

Fix session return types #7006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ext/session/session.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public function write(string $id, string $data);
/** @return bool */
public function destroy(string $id);

/** @return int|bool */
/** @return int|false */
public function gc(int $max_lifetime);
}

interface SessionIdInterface
{
/** @return string */
/** @return string|false */
public function create_sid();
}

Expand Down Expand Up @@ -116,9 +116,9 @@ public function write(string $id, string $data) {}
/** @return bool */
public function destroy(string $id) {}

/** @return int|bool */
/** @return int|false */
public function gc(int $max_lifetime) {}

/** @return string */
/** @return string|false */
public function create_sid() {}
}
2 changes: 1 addition & 1 deletion ext/session/session_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 88f428841bc3e12b949a3308d60eae80d87e563a */
* Stub hash: 22a92834a572985faec8a8eedcd1cdd3e81d02f5 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_name, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, name, IS_STRING, 1, "null")
Expand Down
13 changes: 12 additions & 1 deletion ext/session/tests/session_set_save_handler_closures.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ var_dump(session_module_name(FALSE));
var_dump(session_module_name("blah"));
var_dump(session_module_name("foo"));

$path = __DIR__;
$path = __DIR__ . '/session_set_save_handler_closures';
@mkdir($path);
session_save_path($path);
session_set_save_handler($open_closure, $close_closure, $read_closure, $write_closure, $destroy_closure, $gc_closure);

Expand All @@ -41,7 +42,12 @@ $_SESSION['Bar'] = 'Foo';
var_dump($_SESSION);
session_write_close();

echo "Cleanup\n";
session_start();
session_destroy();

ob_end_flush();
@rmdir($path);
?>
--EXPECTF--
*** Testing session_set_save_handler() : using closures as callbacks ***
Expand Down Expand Up @@ -90,3 +96,8 @@ array(4) {
}
Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;Bar|s:3:"Foo";]
Close [%s,PHPSESSID]
Cleanup
Open [%s,PHPSESSID]
Read [%s,%s]
Destroy [%s,%s]
Close [%s,PHPSESSID]