1--TEST-- 2GH-9583: session_create_id() fails with user defined save handler that doesn't have a validateId() method 3--EXTENSIONS-- 4session 5--FILE-- 6<?php 7 8class SessionHandlerTester implements \SessionHandlerInterface 9{ 10 11 public function close(): bool { return true; } 12 13 public function destroy($id): bool { return true; } 14 15 public function gc($max_lifetime): int|false { return 1; } 16 17 public function open($path, $name): bool { return true; } 18 19 public function read($id): string { return ''; } 20 21 public function write($id, $data): bool { return true; } 22 23 //public function create_sid() { return uniqid(); } 24 25 //public function validateId($key) { return true; } 26} 27 28$obj = new SessionHandlerTester(); 29ini_set('session.use_strict_mode','1'); 30session_set_save_handler($obj); 31session_start(); 32 33$originalSessionId = session_id(); 34 35session_write_close(); 36 37session_start(); 38 39$newSessionId = session_id(); 40 41echo 'validateId() ', (method_exists($obj, 'validateId') ? ('returns ' . ($obj->validateId(1) ? 'true' : 'false')) : 'is commented out'), "\n"; 42var_dump($originalSessionId == $newSessionId); 43 44?> 45--EXPECT-- 46validateId() is commented out 47bool(true) 48