Bug fatal error with is_callable() in Query_Utils.php
-
Hello,
I encountered a fatal error in your plugin (ACF Views / Advanced Views) caused by this line in:
src/Post_Selections/Query/Query_Utils.phpreturn is_callable( $value ) ? $value() : $value;Problem
When
$valueis a string like'date', PHP considers it callable:is_callable('date') === trueSo the plugin executes:
date()without arguments, which triggers:
PHP Fatal error: date() expects at least 1 argument, 0 givenFix
A safer approach is to only execute real closures:
return ($value instanceof \Closure) ? $value() : $value;Why this matters
This prevents unintended execution of native PHP functions (
date,time, etc.) when they are used as string values in query arguments (e.g.orderby => 'date').Let me know if you need more details.
Thanks for your work 👍
José.
You must be logged in to reply to this topic.