You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Grav v1.5.10 and older, the Twig expression {{ url('plugins://doesntexist')|default(url('plugins://exists')) }} would have given the same results as the expression {{ url('plugins://exists') }}, provided plugins://exists existed, and plugins://doesntexist didn't. Now, in Grav v1.6.9 (although I suspect the issue to be there since v1.6.0), the expression returns /. The problem is caused by the Twig function url() having ceased to return null when a path is not found, and the offending commit seems to be 66bba37.
This has caused various issues with all the usecases of url() that depend on it returning null when a path is not found, although the issue with url() combined with the default filter seems to be the most evident example - not only has it caused some breakage in my plugin, it was also visible in the Grav documentation at the time of this writing. Due to that, I would like to request that the regression is fixed soon - sadly, I don't currently have the time nor expertise to figure out how exactly that should be done in order to avoid breaking some three hundred other things using that function.
Great thanks to everyone working hard to make Grav a better CMS for us all.
The text was updated successfully, but these errors were encountered:
Ok after some discussions with @mahagr, we've decided to revert to the previous URL behavior even though this is not really helpful when trying to work out 'why' or 'what' caused the failure in the URL logic. As such I've added a new $fail_gracefully 3rd argument, which when set to true will exhibit the current 1.6 behavior, but is false by default and will return url() the previous behavior.
In Grav v1.5.10 and older, the Twig expression
{{ url('plugins://doesntexist')|default(url('plugins://exists')) }}
would have given the same results as the expression{{ url('plugins://exists') }}
, providedplugins://exists
existed, andplugins://doesntexist
didn't. Now, in Grav v1.6.9 (although I suspect the issue to be there since v1.6.0), the expression returns/
. The problem is caused by the Twig functionurl()
having ceased to return null when a path is not found, and the offending commit seems to be 66bba37.This has caused various issues with all the usecases of
url()
that depend on it returning null when a path is not found, although the issue withurl()
combined with thedefault
filter seems to be the most evident example - not only has it caused some breakage in my plugin, it was also visible in the Grav documentation at the time of this writing. Due to that, I would like to request that the regression is fixed soon - sadly, I don't currently have the time nor expertise to figure out how exactly that should be done in order to avoid breaking some three hundred other things using that function.Great thanks to everyone working hard to make Grav a better CMS for us all.
The text was updated successfully, but these errors were encountered: