laminas-mvc icon indicating copy to clipboard operation
laminas-mvc copied to clipboard

Can't set a controller map template replacement to an empty string

Open michalbundyra opened this issue 5 years ago • 1 comments

The Inject template listener allows specifying a controller_map to map namespaces or specific controllers to directories. It is not currently possible to specify a mapping for a namespace to '' eg:

'controller_map' => [
    'my/long/namespace' => '',
]

This is due to a == comparison with false in the listener on line 142: https://github.com/zendframework/zend-mvc/blob/f46acd021a0d571bc5df400bdd55243adc53580e/src/View/Http/InjectTemplateListener.php#L142 which should probably be ===

Fixing this may break BC...


Originally posted by @carnage at https://github.com/zendframework/zend-mvc/issues/12

michalbundyra avatar Jan 15 '20 19:01 michalbundyra

Suggestions:

  • proposed fix is a bc break, no-go, even for 3.x (it is subtle)
  • use a separate listener for this functionality, and make it act with a lower priority (should be BC compliant then)

Originally posted by @Ocramius at https://github.com/zendframework/zend-mvc/issues/12#issuecomment-120876057

michalbundyra avatar Jan 15 '20 19:01 michalbundyra