On Mon, Aug 5, 2024, at 19:03, Tim Düsterhus wrote:
> >>> If there is a function call to a function with a 'never' return
> >>> type, then that function will potentially throw, or exit.
> >>>
> >>> But that's not relevant for the analysis, as these userland
> >>> functions will have their own oparrays with their entry and exit
> >>> points.
> >>
> >> The compiler has the function table available. It is used to optimize
> >> specific functions into dedicated Opcodes. Thus you should be able to
> >> look up the function within the function table and then check its
> >> return type.
> > 
> > Yes, but functions that call exit are not required to have the 'never'
> > return type, so that's not useful.
> 
> The `exit()` function as implemented in Gina's PR has the `never` return 
> type, thus the situation is no worse than the current situation. Instead 
> of checking for the ZEND_EXIT opcode, you check for a function call and 
> if the function has the `never` return type (which `exit()` is 
> guaranteed to have), then you can treat it as a path ending there. Or 
> you can just hardcode a check for a call to the `exit()` function, as 
> outlined above.

Just to clarify: a never return type doesn't mean execution ends there.

throwing:
https://3v4l.org/s3KDM

infinite loop:
https://3v4l.org/Lpbtt

— Rob

Reply via email to