NotAWizzard
NotAWizzard

Reputation: 157

How to hide browser errors provided by ZendFramework3?

How to hide framework errors that it display in browser? I searcher in application.config, Application module.config tried to change flags and templates but no effect.

How to hide errors in browser but leave them in console?

As a server I'm using right now build in php5.6 server

  'view_manager' => [
    'display_not_found_reason' => true,
    'display_exceptions'       => false,
    'doctype'                  => 'HTML5',
    'not_found_template'       => 'error/404',
    'exception_template'       => 'error/index',
    'template_map' => [
        'layout/layout'           => __DIR__ . '/../view/layout/layout.phtml',
        'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
        'error/404'               => __DIR__ . '/../view/error/custom_404.phtml',
        'error/index'             => __DIR__ . '/../view/error/index.phtml',
    ],
    'template_path_stack' => [
        __DIR__ . '/../view',
    ],
],

Upvotes: 0

Views: 51

Answers (1)

Akansh Braj
Akansh Braj

Reputation: 94

There two ways to do it because zend is a PHP framework so you can hide it with php code or with zend settings file.

1) Core PHP.

error_reporting(E_ALL);
ini_set('display_errors', true);

PHP error settings

2) Zend change your settings as per your requirement false will hide your error.

/*in your module.config.php */
'view_manager' => array(
    'display_not_found_reason' => true,
    'display_exceptions' => true,
    'doctype' => 'HTML5',
    'not_found_template' => 'error/404',
    'exception_template' => 'error/index',
    'template_map' => array(
        'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
        '/index/index' => __DIR__ . '/../view/user/index/index.phtml',
        'error/404' => __DIR__ . '/../view/error/404.phtml',
        'error/index' => __DIR__ . '/../view/error/index.phtml',
    ),
    'template_path_stack' => array(
        __DIR__ . '/../view',
    ),
),

Upvotes: 1

Related Questions