Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001938 [Quercus] major always 08-13-07 08:56 09-19-07 07:40
Reporter chillout View Status public  
Assigned To nam
Priority normal Resolution fixed  
Status closed   Product Version 3.1.2
Summary 0001938: array data corrupt when using symfony framework
Description when using symfony(http://www.symfony-project.com), [^] array data corrupt.

in sfRootConfigHandler class,

  public function execute($configFiles)
  {
    // parse the yaml
    $config = $this->parseYamls($configFiles);

    // determine if we're loading the system config_handlers.yml or a module config_handlers.yml
    $moduleLevel = ($this->getParameterHolder()->get('module_level') === true) ? true : false;

    if ($moduleLevel)
    {
      // get the current module name
      $moduleName = $this->getParameterHolder()->get('module_name');
    }

    // init our data and includes arrays
    $data = array();
    $includes = array();

    // let's do our fancy work
    foreach ($config as $category => $keys)
    {
      if ($moduleLevel)
      {
        // module-level registration, so we must prepend the module
        // root to the category
        $category = 'modules/'.$moduleName.'/'.$category;
      }
      var_dump($keys);
      // result is array(1) { ["class"]=> string(23) "sfAutoloadConfigHandler" }
      var_dump($keys['class']);
      // result is NULL
      // this must be string(23) "sfAutoloadConfigHandler"
      var_dump(array_key_exists('class', $keys));
      // result is bool(false)
      // this must be bool(true)
      if (!isset($keys['class']))
      {
        // missing class key
        $error = sprintf('Configuration file "%s" specifies category "%s" with missing class key', $configFiles[0], $category);
        throw new sfParseException($error);
      }
Additional Information using CentOS 5, resin3.1.2, quercus3.1.2

how to confirm this issue.

1. download http://www.symfony-project.com/get/sf_sandbox.tgz, [^] uncompress and
move sf_sandbox/* to WEB-INF directory
2. cp WEB-INF/web/index.php ../
3. edit index.php
change SF_ROOT_DIR constants to
define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/WEB-INF'));
4. access index.php through your browser
Attached Files

- Relationships

- Notes
(0002188)
chillout
08-13-07 08:59

out of symfony framework, this code will work well

<?php
$config = array('config/autoload.yml' => array('class' => 'sfAutoloadConfigHandler', ),
                'config/php.yml' => array('class' => 'sfPhpConfigHandler', ),
                'config/databases.yml' => array('class' => 'sfDatabaseConfigHandler', ),
                'config/settings.yml' => array('class' => 'sfDefineEnvironmentConfigHandler', 'param' => array('prefix' => 'sf_', ), ),
                'config/app.yml' => array('class' => 'sfDefineEnvironmentConfigHandler', 'param' => array('prefix' => 'app_', ), ),
                'config/factories.yml' => array('class' => 'sfFactoryConfigHandler', ),
                'config/bootstrap_compile.yml' => array('class' => 'sfCompileConfigHandler', ),
                'config/core_compile.yml' => array('class' => 'sfCompileConfigHandler', ),
                'config/filters.yml' => array('class' => 'sfFilterConfigHandler', ),
                'config/logging.yml' => array('class' => 'sfLoggingConfigHandler', 'param' => array('prefix' => 'sf_logging_', ), ),
                'config/routing.yml' => array('class' => 'sfRoutingConfigHandler', ),
                'config/i18n.yml' => array('class' => 'sfDefineEnvironmentConfigHandler', 'param' => array('prefix' => 'sf_i18n_', ), ),
                'modules/*/config/generator.yml' => array('class' => 'sfGeneratorConfigHandler', ),
                'modules/*/config/view.yml' => array('class' => 'sfViewConfigHandler', ),
                'modules/*/config/mailer.yml' => array('class' => 'sfDefineEnvironmentConfigHandler', 'param' => array('prefix' => 'sf_mailer_', 'module' => tr\
ue, ), ),
                'modules/*/config/security.yml' => array('class' => 'sfSecurityConfigHandler', ),
                'modules/*/config/cache.yml' => array('class' => 'sfCacheConfigHandler', ),
                'modules/*/validate/*.yml' => array('class' => 'sfValidatorConfigHandler', ),
                'modules/*/config/module.yml' => array('class' => 'sfDefineEnvironmentConfigHandler', 'param' => array('prefix' => 'mod_', 'module' => true, ),\
 ), );
    foreach ($config as $category => $keys){
        var_dump($keys['class']);

}


result is

string(23) "sfAutoloadConfigHandler"
string(18) "sfPhpConfigHandler"
string(23) "sfDatabaseConfigHandler"
string(32) "sfDefineEnvironmentConfigHandler"
string(32) "sfDefineEnvironmentConfigHandler"
string(22) "sfFactoryConfigHandler"
string(22) "sfCompileConfigHandler"
string(22) "sfCompileConfigHandler"
string(21) "sfFilterConfigHandler"
string(22) "sfLoggingConfigHandler"
string(22) "sfRoutingConfigHandler"
string(32) "sfDefineEnvironmentConfigHandler"
string(24) "sfGeneratorConfigHandler"
string(19) "sfViewConfigHandler"
string(32) "sfDefineEnvironmentConfigHandler"
string(23) "sfSecurityConfigHandler"
string(20) "sfCacheConfigHandler"
string(24) "sfValidatorConfigHandler"
string(32) "sfDefineEnvironmentConfigHandler"
 
(0002200)
nam
08-14-07 11:02

What version of symphony framework are you using?

What kind of 'array corruption' are you seeing and when are you seeing it?
 
(0002201)
chillout
08-15-07 02:14

symfony version is 1.0.6,

when i access index.php using browser,
sfRootConfigHandler::execute is executed internally.

in foreach loop as i showed in description,
var_dump($keys); result is
array(1) { ["class"]=> string(23) "sfAutoloadConfigHandler" }

at next line,
var_dump($keys['class']); result is NULL.
this might be string(23) "sfAutoloadConfigHandler"


i placed sample application http://ninjyazone.com/files/symfony.war [^]
install it and access index.php, and you will see this issue.
 
(0002304)
ferg
09-19-07 07:40

php/0i20
 

- Issue History
Date Modified Username Field Change
08-13-07 08:56 chillout New Issue
08-13-07 08:59 chillout Note Added: 0002188
08-13-07 15:52 nam Status new => assigned
08-13-07 15:52 nam Assigned To  => nam
08-14-07 11:02 nam Note Added: 0002200
08-15-07 02:14 chillout Note Added: 0002201
09-19-07 07:40 ferg Note Added: 0002304
09-19-07 07:40 ferg Status assigned => closed
09-19-07 07:40 ferg Resolution open => fixed
09-19-07 07:40 ferg Fixed in Version  => 3.1.3


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
36 total queries executed.
30 unique queries executed.
Powered by Mantis Bugtracker