Development

#3429 (sfGeneratorConfigHandler: Bug if "/modules/" is part of the project path)

You must first sign up to be able to contribute.

Ticket #3429 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

sfGeneratorConfigHandler: Bug if "/modules/" is part of the project path

Reported by: lathspell Assigned to: fabien
Priority: minor Milestone: 1.0.14
Component: generator Version: 1.1.0 BETA4
Keywords: modules init-admin generator Cc:
Qualification: Unreviewed

Description

Hello

If a project happens to be in a directory which has a /modules/ part in it the Admin Generator looks for the wrong filename and outputs:

Fatal error: Class 'autotesttableActions' not found in /home/ch/workspace/modules/bug/apps/frontend/modules/testtable/actions/actions.class.php on line 11

As you can see there is a directory "modules" above the base directory of the Symfony application "bug". This confuses the following line of symfony-1.1 trunk:

 lib/config/sfGeneratorConfigHandler.class.php line 68
 ...
     public function execute($configFiles)
     ...
        // hack to find the module name
        preg_match('#modules/([^/]+)/#', $configFiles[0], $match);
        $generatorParam['moduleName'] = $match[1];

My suggested fix would be to make the regex "greedy" by adding ".*" at the beginning:

--- lib/config/sfGeneratorConfigHandler.class.php       (revision 8631)
+++ lib/config/sfGeneratorConfigHandler.class.php       (working copy)
@@ -64,8 +64,8 @@
     // generator parameters
     $generatorParam = (isset($config['param']) ? $config['param'] : array());
 
-    // hack to find the module name
-    preg_match('#modules/([^/]+)/#', $configFiles[0], $match);
+    // hack to find the module name after the last /modules/ directory
+    preg_match('#.*/modules/([^/]+)/#', $configFiles[0], $match);
     $generatorParam['moduleName'] = $match[1];
 
     // compile data

Change History

05/04/08 09:08:19 changed by fabien

  • milestone set to 1.0.14.

05/04/08 09:12:12 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

in r8761 and r8762