Reputation: 627
I have follow the simple steps of zend documentation to develop a many simple console action.
My action have only one literal param. It works ok and the action is executed but before, in each call appears following notice and a stack trace.
How I do for remove / solve this message
Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in C:\xampp\htdocs\pfc_desarrollo\module\SecureDraw\Module.php on line 124
Call Stack:
0.0003 121464 1. {main}() C:\xampp\htdocs\pfc_desarrollo\public\index.php:0
0.0079 237776 2. Zend\Mvc\Application::init() C:\xampp\htdocs\pfc_desarrollo\public\index.php:12
0.1589 1822568 3. Zend\Mvc\Application->bootstrap() C:\xampp\htdocs\pfc_desarrollo\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php:239
0.2135 2232464 4. Zend\EventManager\EventManager->trigger() C:\xampp\htdocs\pfc_desarrollo\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php:142
0.2135 2232584 5. Zend\EventManager\EventManager->triggerListeners() C:\xampp\htdocs\pfc_desarrollo\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:204
0.2350 2387304 6. call_user_func() C:\xampp\htdocs\pfc_desarrollo\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:460
0.2350 2387320 7. SecureDraw\Module->onBootstrap() C:\xampp\htdocs\pfc_desarrollo\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:460
--------------------------------HELLOOOOOO------------------
This is my action / route definition
//module.php
'console' => array(
'router' => array(
'routes' => array(
'hello' => array(
'options' => array(
'route' => 'hello',
'defaults' => array(
'controller' => 'SecureDraw\Controller\Participant',
'action' => 'hello',
),
),
), //Line 124
),
),
),
//Participant.php
public function helloAction(){
return "--------------------------------HELLOOOOOO------------------";
}
Upvotes: 0
Views: 433
Reputation: 12809
You must be trying to access the Server Variable HTTP_ACCEPT_LANGUAGE inside your Module.php file.
$_SERVER['HTTP_ACCEPT_LANGUAGE'] is usally set using the Browser which has requested the page, but as your are running the app from the console it is probably not getting set.
You should check to see if it's set before accessing it.
Upvotes: 1