[php-src] master: readline: add some trampoline tests

From: Date: Sun, 18 Oct 2026 12:02:55 +0000
Subject: [php-src] master: readline: add some trampoline tests
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142398@lists.php.net to get a copy of this message
Author: Gina Peter Banyard (Girgias) Date: 2026-10-18T13:02:52+01:00 Commit: https://github.com/php/php-src/commit/e20094bf44c086bfd91b84d347606054b8775845 Raw diff: https://github.com/php/php-src/commit/e20094bf44c086bfd91b84d347606054b8775845.diff readline: add some trampoline tests Changed paths: A ext/readline/tests/readline_callback_handler_trampoline.phpt A ext/readline/tests/readline_completion_function_trampoline.phpt Diff: diff --git a/ext/readline/tests/readline_callback_handler_trampoline.phpt b/ext/readline/tests/readline_callback_handler_trampoline.phpt new file mode 100644 index 000000000000..6d55aab933f4 --- /dev/null +++ b/ext/readline/tests/readline_callback_handler_trampoline.phpt @@ -0,0 +1,28 @@ +--TEST-- +readline_callback_handler_install() with trampoline +--EXTENSIONS-- +readline +--SKIPIF-- +<?php if (!function_exists('readline_callback_handler_install')) die("skip"); +if (READLINE_LIB == "libedit") die("skip readline only"); +?> +--FILE-- +<?php + +class TrampolineTest { + public function __call(string $name, array $arguments) { + return 'Trampoline for ' . $name . "\n"; + } +} +$o = new TrampolineTest(); +$callback = [$o, 'trampoline']; + +var_dump(readline_callback_handler_install('testing: ', $callback)); +var_dump(readline_callback_handler_remove()); +var_dump(readline_callback_handler_install('testing: ', $callback)); + +?> +--EXPECT-- +testing: bool(true) +bool(true) +testing: bool(true) diff --git a/ext/readline/tests/readline_completion_function_trampoline.phpt b/ext/readline/tests/readline_completion_function_trampoline.phpt new file mode 100644 index 000000000000..43b8ffe94ca2 --- /dev/null +++ b/ext/readline/tests/readline_completion_function_trampoline.phpt @@ -0,0 +1,25 @@ +--TEST-- +readline_completion_function(): Basic test +--EXTENSIONS-- +readline +--FILE-- +<?php + +class TrampolineTest { + public function __call(string $name, array $arguments) { + echo 'Trampoline for ', $name, PHP_EOL; + return []; + } +} +$o = new TrampolineTest(); +$callback = [$o, 'trampoline']; + +var_dump(readline_completion_function($callback)); +var_dump(readline_completion_function('strtolower')); +var_dump(readline_completion_function($callback)); + +?> +--EXPECT-- +bool(true) +bool(true) +bool(true)

« previous php.cvs (#142398) next »