Development

Changeset 8514

You must first sign up to be able to contribute.

Changeset 8514

Show
Ignore:
Timestamp:
04/17/08 20:25:39 (6 months ago)
Author:
fabien
Message:

added validation for application/module/task names (closes #3228)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/task/generator/sfGenerateAppTask.class.php

    r8260 r8514  
    9090    $app = $arguments['application']; 
    9191 
     92    // Validate the application name 
     93    if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $app)) 
     94    { 
     95      throw new sfCommandException(sprintf('The application name "%s" is invalid.', $app)); 
     96    } 
     97 
    9298    $appDir = sfConfig::get('sf_apps_dir').'/'.$app; 
    9399 
  • branches/1.1/lib/task/generator/sfGenerateModuleTask.class.php

    r8148 r8514  
    7070    $module = $arguments['module']; 
    7171 
     72    // Validate the module name 
     73    if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $app)) 
     74    { 
     75      throw new sfCommandException(sprintf('The module name "%s" is invalid.', $app)); 
     76    } 
     77 
    7278    $moduleDir = sfConfig::get('sf_app_module_dir').'/'.$module; 
    7379 
  • branches/1.1/lib/task/generator/sfGenerateTaskTask.class.php

    r8513 r8514  
    6363    $name = isset($taskNameComponents[1]) ? $taskNameComponents[1] : $taskNameComponents[0]; 
    6464    $taskClassName = str_replace('-', '', ($namespace ? $namespace.ucfirst($name) : $name)).'Task'; 
     65 
     66    // Validate the class name 
     67    if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $app)) 
     68    { 
     69      throw new sfCommandException(sprintf('The task class name "%s" is invalid.', $app)); 
     70    } 
     71 
    6572    $briefDescription = $options['brief-description']; 
    6673    $detailedDescription = <<<HED