php-src icon indicating copy to clipboard operation
php-src copied to clipboard

PHP 8.6: unable to create PFA callable from never-returning function

Open ondrejmirtes opened this issue 2 weeks ago • 2 comments

Description

The following code:

<?php

function doFoo($a): never {
	
}

doFoo(...); // works
doFoo(?); // does not work

Resulted in this output:

Fatal error: A never-returning function must not return in test.php on line 8

But I expected this output instead:

(empty)

PHP Version

PHP 8.6.0-dev (cli) (built: Nov 11 2026 23:30:36) (NTS)
Copyright © The PHP Group and Contributors
Built by Shivam Mathur
Zend Engine v4.6.0-dev, Copyright © Zend by Perforce
    with Zend OPcache v8.6.0-dev, Copyright ©, by Zend by Perforce

Operating System

macOS 27.2.1

ondrejmirtes avatar Nov 13 '26 11:11 ondrejmirtes

Already fixed in 5e8d15e57017efb1076b513f5bce67c9ce980f25

TimWolla avatar Nov 13 '26 13:11 TimWolla

Thank you!

ondrejmirtes avatar Nov 13 '26 14:11 ondrejmirtes