2008年10月31日星期五

[fw-mvc] ViewRenderer Script Path BUG

The ViewRenderer currently checks the path stack to see if a path exists prior to adding it.  This is causing a small bug for me.

If module1-controller1-action1 forwards to module2-controller1-action1, which then forwards back to module1-controller1-action1, the view path stack is incorrect.  The path for module1 views is never unshifted back onto the path stack (as it already exists in there), so when rendered, it renders the views from module2.

Current Stack Result:
array(2) {
  [0] => string(76) "/directory/module2/views/scripts/"   [1] => string(76) "/directory/module1/views/scripts/" } 
Expected Stack Result:
array(3) {
  [0] => string(76) "/directory/module1/views/scripts/"   [1] => string(76) "/directory/module2/views/scripts/"   [2] => string(76) "/directory/module1/views/scripts/" } 
Or
array(3) {
  [0] => string(76) "/directory/module1/views/scripts/"   [1] => string(76) "/directory/module2/views/scripts/" } 

What I'm trying to accomplish is actions firing in a specific sequence.  If we are out of sequence, need to forward to the correct action.

Simple fix is to just add paths to the view script stack WITHOUT checking if it first exists.  That is my current temp fix (I just commented out $pathExists = true).

Otherwise, another fix would be, if the path exists, splice it and push it to the top of the stack.

Arthur

没有评论: