#626: Including view files by hand may lead to multiple includes of the class
file
-----------------------------------------+----------------------------------
 Reporter:  [EMAIL PROTECTED]  |        Owner:  david  
     Type:  defect                       |       Status:  closed 
 Priority:  normal                       |    Milestone:  0.11.1 
Component:  controller                   |      Version:  0.11.0 
 Severity:  minor                        |   Resolution:  wontfix
 Keywords:  view slot                    |  
-----------------------------------------+----------------------------------
Changes (by david):

  * status:  new => closed
  * resolution:  => wontfix

Comment:

 Please use a common base view you extend both your Error and Input views
 from. You can define per-module autoloads in
 {{{modules/Auth/config/autoload.xml}}}. I'm closing this ticket as
 ''wontfix'', because a {{{require_once}}} instead of a {{{require}}} poses
 significant problems to opcode caches.

 We cannot do the same {{{class_exists()}}} calls that are done to find the
 class after loading the file to check for the view class' existance before
 including it either, because we could not reliably determine if the view
 that is found during those calls is actually the one intended to be
 loaded. For example:
  1. {{{createViewInstance('Default', 'ZomgSuccess'); loads
 {{{modules/Default/views/ZomgSuccessView.class.php}}} which contains a
 class called "ZomgSuccessView"
  1. {{{createViewInstance('Default2', 'ZomgSuccess'); loads
 {{{modules/Default2/views/ZomgSuccessView.class.php}}} which contains a
 class called "Default2_ZomgSuccessView"
 In this second call, if all four {{{class_exists()}}} calls were made
 before calling {{{require()}}} on the file to see if the view is there
 already:
 {{{
 if(class_exists($moduleName . '_' . $longViewName . 'View', false)) {
         $class = $moduleName . '_' . $longViewName . 'View';
 } elseif(class_exists($moduleName . '_' . $viewName . 'View', false)) {
         $class = $moduleName . '_' . $viewName . 'View';
 } elseif(class_exists($longViewName . 'View', false)) {
         $class = $longViewName . 'View';
 } elseif(class_exists($viewName . 'View', false)) {
         $class = $viewName . 'View';
 }
 }}}
 the last call would yield true, and the wrong view instance would be
 returned. Therefor, we cannot implement such a check because it cannot be
 made to work reliably under all naming schemes.

 Similarly, if we decide to only try the full name with the module prefix,
 then such a thing would only be possible with this naming scheme,
 introducing an inconsistency into Agavi I would rather not have.

 Feel free to comment on this ticket if you have further questions, or mail
 to the dev mailing list, or join us for a chat on IRC.

-- 
Ticket URL: <http://trac.agavi.org/ticket/626#comment:2>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5


_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets

Reply via email to