Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
Test session_set_save_handler() function : error functionality
--EXTENSIONS--
session
--INI--
session.save_handler=
--FILE--
<?php
try {
session_set_save_handler(new \SessionHandler(), true);
session_start();
} catch (Throwable $e) {
echo $e->getMessage() . "\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I prefer seeing what exception is being thrown

Suggested change
echo $e->getMessage() . "\n";
echo $e::class . ': ' . $e->getMessage() . "\n";

Copy link
Contributor Author

@jorgsowa jorgsowa Aug 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Added

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you forget to push?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sorry. Internet connection interruption.

}
echo "ok";
?>
--EXPECT--
Cannot call default session handler
ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
Test session_set_save_handler() function : error functionality
--EXTENSIONS--
session
--INI--
session.save_handler=
--FILE--
<?php
ob_start();

session_start();
session_set_save_handler(new \SessionHandler(), true);

echo "ok";
ob_end_flush();
?>
--EXPECTF--
Warning: session_start(): Cannot find session save handler "" - session startup failed in %s on line %d
ok