[Symfony1.4] How to Configure Settings to Hide Strict, Deprecated Errors and Warnings

Tadashi Shigeoka ·  Wed, September 7, 2011

In Symfony1.4, when using PEAR, a large number of Strict errors, Deprecated errors, and other warnings were output.

I changed the error output settings in php.ini, but they weren’t reflected in the Symfony program.

Symfony has error_reporting written in project_home/apps/frontend/config/settings.yml, so it seems to override the php.ini settings.

By the way, you can search for files containing the word “error_reporting” using the grep command as follows:

# grep -R error_reporting ./

./cache/frontend/dev/config/config_settings.yml.php:  'sf_error_reporting' => 32767,
./apps/frontend/config/settings.yml:    error_reporting:        
./apps/frontend/config/settings.yml:    error_reporting:        

Relevant sections were found.

In the cache’s config_settings.yml.php, there’s ‘sf_error_reporting’ => 32767, and since 32767 is the default E_ALL | E_STRICT, this confirms that the php.ini settings aren’t being reflected on the Symfony side.

By default, settings.yml looks like this:

# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/04-Settings

prod:
  .settings:
    no_script_name:         true
    logging_enabled:        false

dev:
  .settings:
    error_reporting:        
    web_debug:              true
    cache:                  false
    no_script_name:         false
    etag:                   false

test:
  .settings:
    error_reporting:        
    cache:                  false
    web_debug:              false
    no_script_name:         false
    etag:                   false

all:
  .settings:
    # Form security secret (CSRF protection)
    csrf_secret:            ebfxa42b0x90387xd2fx4d24xd00xxx38c1a9x16

    # Output escaping settings
    escaping_strategy:      true
    escaping_method:        ESC_SPECIALCHARS

    # Enable the database manager
    use_database:           true

Change the dev section as follows to prevent Strict errors and Deprecated errors from being displayed:

dev:
  .settings:
    error_reporting:        

That’s all from the Gemba.