As always, excellent analysis. This seems like the most sane approach
to tackling more problems.

Also, fosdevel's new log capability can be tied into this in the error
class.

Fosdevel, any thoughts on this?

Jon

On Thu, Jun 9, 2011 at 3:19 PM, Roger Martín <[email protected]> wrote:
> WP is good start point.
>
> There are three type of files:
> - direct files: index.php, style.php who need aiki object.
> - files like assets/apps/admin called by ajax. who neek aiki object too.
> - independent files as captcha.php.
>
> The general solution can be:
>
> if ( there is a debug in $_GET)    // necesary if we permitted debug by
> 'demand'
>      establish new error level as $_GET
> elseif ( there is a db connection and can get debug options  //so every site
> can edit the debug level.
>    establish new error level as options
> elseif ( if $config has a debug key)   // or can establish it in config file
>    establish new error level as options
> else
>   establish new error level as 1
>
> for independent files
> if ( $_GET [debug]=on or 1)
>   display errors
> else
>  hide all errors.
>
>
> error levels
> 0,off no debug
> 1,on. if aiki is runnig display elegant error screen.
> 2,log level 1 + log errors.
>
>
> PD: aiki has already a error class, but only handles 404 pages..
>
> _______________________________________________
> Mailing list: https://launchpad.net/~aikiframework-devel
> Post to     : [email protected]
> Unsubscribe : https://launchpad.net/~aikiframework-devel
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Jon Phillips
http://rejon.org/ | http://fabricatorz.com/
chat/skype: kidproto | irc: rejon
+1.415.830.3884 (global) | +1-510-499-0894 (sf)
+86-187-1003-9974 (beijing)

-- 
You received this bug notification because you are a member of Aiki
Framework Admins, which is subscribed to aikiframework.
https://bugs.launchpad.net/bugs/794857

Title:
  fix default php error level and attach to debug config

Status in Aiki Framework:
  Confirmed

Bug description:
  Notice that the default aiki is in src/index.php:

   error_reporting(E_STRICT | E_ALL);

  However, when a problem with aiki, we get loads of php spew that is
  not helpful in runtime instances. Also, I think we need super strict
  error_reporting when config['debug'] = true so that errors can be
  pinpointed.

  Is the current error setting and across aiki adequate for runtime and
  devtime use?

  Here is php doc on it  http://php.net/manual/en/function.error-
  reporting.php


  Below are the examples from wordpress and mediawiki for default error
  levels.

  ###

  
  errro stuf from wordpress

  /**
   * Sets PHP error handling and handles WordPress debug mode.
   *
   * Uses three constants: WP_DEBUG, WP_DEBUG_DISPLAY, and WP_DEBUG_LOG. All 
three can be
   * defined in wp-config.php. Example: <code> define( 'WP_DEBUG', true ); 
</code>
   *
   * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is 
true.
   * WP_DEBUG defaults to false.
   *
   * When WP_DEBUG is true, all PHP notices are reported. WordPress will also 
display
   * notices, including one when a deprecated WordPress function, function 
argument,
   * or file is used. Deprecated code may be removed from a later version.
   *
   * It is strongly recommended that plugin and theme developers use WP_DEBUG 
in their
   * development environments.
   *
   * When WP_DEBUG_DISPLAY is true, WordPress will force errors to be displayed.
   * WP_DEBUG_DISPLAY defaults to true. Defining it as false prevents WordPress 
from
   * changing the global configuration setting. (Defining WP_DEBUG_DISPLAY as 
false
   * will never force errors to be hidden.)
   *
   * When WP_DEBUG_LOG is true, errors will be logged to wp-content/debug.log.
   * WP_DEBUG_LOG defaults to false.
   *
   * @access private
   * @since 3.0.0
   */
  function wp_debug_mode() {
      if ( WP_DEBUG ) {
          // E_DEPRECATED is a core PHP constant in PHP 5.3. Don't define this 
yourself.
          // The two statements are equivalent, just one is for 5.3+ and for 
less than 5.3.
          if ( defined( 'E_DEPRECATED' ) )
              error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT );
          else
              error_reporting( E_ALL );

          if ( WP_DEBUG_DISPLAY )
              ini_set( 'display_errors', 1 );

          if ( WP_DEBUG_LOG ) {
              ini_set( 'log_errors', 1 );
              ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
          }
      } else {
          error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | 
E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | 
E_RECOVERABLE_ERROR );
      }
  }


  ####

  mw default error level

  
  $originalLevel = error_reporting( E_ALL & ~( E_WARNING | E_NOTICE | 
E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED ) );

  
  ####

To manage notifications about this bug go to:
https://bugs.launchpad.net/aikiframework/+bug/794857/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework.admins
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework.admins
More help   : https://help.launchpad.net/ListHelp

Reply via email to