Prestashop 1.6 php error in smarty_internal_templatebase - php

PrestaShop 1.6.1.20
PHP 5.6.37
Hi,
I tried to install a new module on my website but i end up with this php error that i don't know how to debug.
[29-Nov-2018 15:58:11 Europe/Paris] PHP Notice: Undefined index: prod in C:\wamp64\www\prestashop\tools\smarty\sysplugins\smarty_internal_templatebase.php(157) : eval()'d code on line 115
[29-Nov-2018 15:58:11 Europe/Paris] PHP Stack trace:
[29-Nov-2018 15:58:11 Europe/Paris] PHP 1. {main}() C:\wamp64\www\prestashop\index.php:0
[29-Nov-2018 15:58:11 Europe/Paris] PHP 2. DispatcherCore->dispatch() C:\wamp64\www\prestashop\index.php:28
[29-Nov-2018 15:58:11 Europe/Paris] PHP 3. ControllerCore->run() C:\wamp64\www\prestashop\classes\Dispatcher.php:367
[29-Nov-2018 15:58:11 Europe/Paris] PHP 4. IndexControllerCore->initContent() C:\wamp64\www\prestashop\classes\controller\Controller.php:189
[29-Nov-2018 15:58:11 Europe/Paris] PHP 5. HookCore::exec() C:\wamp64\www\prestashop\controllers\front\IndexController.php:40
[29-Nov-2018 15:58:11 Europe/Paris] PHP 6. HookCore::coreCallHook() C:\wamp64\www\prestashop\classes\Hook.php:548
[29-Nov-2018 15:58:11 Europe/Paris] PHP 7. HomecategoriesPlus->hookHome() C:\wamp64\www\prestashop\classes\Hook.php:591
[29-Nov-2018 15:58:11 Europe/Paris] PHP 8. ModuleCore->display() C:\wamp64\www\prestashop\modules\homecategoriesplus\homecategoriesplus.php:767
[29-Nov-2018 15:58:11 Europe/Paris] PHP 9. Smarty_Custom_Template->fetch() C:\wamp64\www\prestashop\classes\module\Module.php:2309
[29-Nov-2018 15:58:11 Europe/Paris] PHP 10. Smarty_Internal_TemplateBase->fetch() C:\wamp64\www\prestashop\classes\SmartyCustom.php:308
[29-Nov-2018 15:58:11 Europe/Paris] PHP 11. content_5bfffe83b6f704_96197512() C:\wamp64\www\prestashop\tools\smarty\sysplugins\smarty_internal_templatebase.php:188
I've tried to look for 'prod' in smarty_internal_templatebase.php but i didn't found anything. would anyone have an idea about where to look and how to fix this ?

Look at the module homecategoriesplus.php at line 767. Your debug says this. I think you just need to add a condition in your homecategoriesplus.tpl to check if the variable prod exists. Something like
{if isset($prod) && $prod}
/*your code here*/
{/if}
or just set default value to the variable during creating it in the homecategoriesplus.php

Related

Including file from various folders

This has been giving me a headache. I've read multiple questions but none helped me.
So I need to include php files from different folders. Here's how my structure looks like. I'm using WAMP.
/C
/wamp
/www
/project1
/main
/backend
-class.common.php
-inc.config.php
/providers
/google
-google.functions.php
So as clear from the structure above, class.common.php is under folder backend (Which is under folder main).
Now, I'm trying to include class.common.php in google.functions.php using THIS code :-
include '../../class.common.php';
However, this doesn't seem to work. I've even tried working with the __DIR__ constant. No luck. What's the most robust way to achieve my result?
PHP Error Log.
[15-Jun-2016 22:16:25 Europe/Paris] PHP Warning: include(../../_inc_config.php): failed to open stream: No such file or directory in C:\wamp\www\yele\main\backend\api_providers\rech\api_functions.php on line 3
[15-Jun-2016 22:16:25 Europe/Paris] PHP Stack trace:
[15-Jun-2016 22:16:25 Europe/Paris] PHP 1. {main}() C:\wamp\www\yele\main\backend\ajax.php:0
[15-Jun-2016 22:16:25 Europe/Paris] PHP 2. include() C:\wamp\www\yele\main\backend\ajax.php:2
[15-Jun-2016 22:16:25 Europe/Paris] PHP 3. include() C:\wamp\www\yele\main\backend\class.apibase.php:3
[15-Jun-2016 22:16:25 Europe/Paris] PHP 4. include() C:\wamp\www\yele\main\backend\api_providers\rech\base_lib.php:2
[15-Jun-2016 22:16:25 Europe/Paris] PHP Warning: include(): Failed opening '../../_inc_config.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\yele\main\backend\api_providers\rech\api_functions.php on line 3
[15-Jun-2016 22:16:25 Europe/Paris] PHP Stack trace:
[15-Jun-2016 22:16:25 Europe/Paris] PHP 1. {main}() C:\wamp\www\yele\main\backend\ajax.php:0
[15-Jun-2016 22:16:25 Europe/Paris] PHP 2. include() C:\wamp\www\yele\main\backend\ajax.php:2
[15-Jun-2016 22:16:25 Europe/Paris] PHP 3. include() C:\wamp\www\yele\main\backend\class.apibase.php:3
[15-Jun-2016 22:16:25 Europe/Paris] PHP 4. include() C:\wamp\www\yele\main\backend\api_providers\rech\base_lib.php:2
[15-Jun-2016 22:16:25 Europe/Paris] PHP Fatal error: Cannot redeclare class common in C:\wamp\www\yele\main\backend\class.common.php on line 5
[15-Jun-2016 22:16:25 Europe/Paris] PHP Stack trace:
[15-Jun-2016 22:16:25 Europe/Paris] PHP 1. {main}() C:\wamp\www\yele\main\backend\ajax.php:0
[15-Jun-2016 22:16:25 Europe/Paris] PHP 2. include() C:\wamp\www\yele\main\backend\ajax.php:3
I'm not sure I'm reading your diagram properly, but given the following:
if the full path to google.functions.php is
C:/wamp/www/project1/main/backend/providers/google/google.functions.php
and the full path to class.common.php is
C:/wamp/www/project1/main/backend/class.common.php
to include that file relative wherever it is, then __DIR__ should work
<?php
include_once __DIR__.'/../../class.common.php';
Update
From the looks of your error logs, you have a couple problems.
the include failure is happening in C:\wamp\www\yele\main\backend\api_providers\rech\api_functions.php which is calling a path relative include include(../../_inc_config.php), which changes depending on which file the script is included from. so this is odd for a vendor, but you can try changing the line to include(__DIR__.'/../../_inc_config.php') to force it to include relative to the actual including file, which is coincidentally my original answer for your problem.
you have a fatal error with redeclaring the common class, so use include_once or require_once
firsty, getting real/physical path can be more usable
include realpath('/../../class.common.php');

Modx Evo - After copy from webserver to localhost manager login not possible anymore

I am using the latest WAMPServer64 with PHP 5.5.12.
What I did: From a webserver (runs PHP 5.4.16) I have copied the modx folders to localhost, then I copied the entire database. I have also changed the database credentials accordingly via manager/includes/confic.inc.php.
When opening the manager login, I see the following:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in \manager\includes\extenders\dbapi.mysql.class.inc.php on line 93
When I try to login, the manager does not show up and I get a bunch of errors, content of php_error.log:
PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in manager\includes\extenders\dbapi.mysql.class.inc.php on line 93
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP 2. DBAPI->escape() manager\processors\login.processor.php:51
PHP 3. DBAPI->connect() manager\includes\extenders\dbapi.mysql.class.inc.php:156
PHP 4. mysql_connect() manager\includes\extenders\dbapi.mysql.class.inc.php:93
PHP Notice: Undefined index: captcha_code in manager\processors\login.processor.php on line 53
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP Notice: Undefined index: rememberme in manager\processors\login.processor.php on line 54
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP Notice: Undefined variable: allowed_ip in manager\processors\login.processor.php on line 134
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP Notice: Undefined variable: allowed_days in manager\processors\login.processor.php on line 148
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP Notice: Undefined variable: newloginerror in manager\processors\login.processor.php on line 224
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP Warning: Cannot modify header information - headers already sent by (output started at manager\processors\login.processor.php:54) in manager\processors\login.processor.php on line 298
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP 2. setcookie() manager\processors\login.processor.php:298
PHP Notice: Undefined variable: sql in manager\includes\extenders\dbapi.mysql.class.inc.php on line 276
PHP Stack trace:
PHP 1. {main}() manager\processors\login.processor.php:0
PHP 2. logHandler->initAndWriteLog() manager\processors\login.processor.php:302
PHP 3. logHandler->writeToLog() manager\includes\log.class.inc.php:42
PHP 4. DBAPI->insert() manager\includes\log.class.inc.php:76
I have searched for solutions on the net, some suggested to clear the cache, which is not directly possible since the manager interface does not load. I also tried to upgrade using the default install folder, same problem remains.
So if anyone has a clue how I can solve this without installing an old version of PHP, that would be great.
To get rid of the mysql deprecated warning you have to use Evo 1.0.15+ and you should change
$database_type = 'mysql';
to
$database_type = 'mysqli';
in config.inc.php
The 'only' thing that uses the old mysql_ functions is the installer then. The deprecated warnings are disabled in there for PHP 5.5.
MODx Evolution has a lot of old code in it. As you see by your warnings it is using deprecated mysql-functions. This is long known in the MODx Forums.
As for now you have two possible solutions:
Downgrade your local php version via WAMP to some (best, the same) PHP 5.4 version.
Change your PHP error-reporting level (inside the affected files or in your php.ini) to omit deprecated errors, as long as Evo has this issue.
Can check following solution
https://toster.ru/q/125593
really works !
:)

How can I make a vim fold expression for PHP stack traces?

I'm using xdebug to produce stack traces in my Wordpress debug.log, and it gives me these stack traces that look like this:
[02-May-2014 16:35:14 UTC] PHP Stack trace:
[02-May-2014 16:35:14 UTC] PHP 1. {main}() /var/www/wp-admin/index.php:0
[02-May-2014 16:35:14 UTC] PHP 2. wp_dashboard() /var/www/wp-admin/index.php:125
[02-May-2014 16:35:14 UTC] PHP 3. do_meta_boxes() /var/www/wp-admin/includes/dashboard.php:149
[02-May-2014 16:35:14 UTC] PHP 4. call_user_func() /var/www/wp-admin/includes/template.php:924
[02-May-2014 16:35:14 UTC] PHP 5. wp_dashboard_site_activity() /var/www/wp-admin/includes/template.php:924
[02-May-2014 16:35:14 UTC] PHP 6. wp_dashboard_recent_posts() /var/www/wp-admin/includes/dashboard.php:538
[02-May-2014 16:35:14 UTC] PHP 7. WP_Query->__construct() /var/www/wp-admin/includes/dashboard.php:587
[02-May-2014 16:35:14 UTC] PHP 8. WP_Query->query() /var/www/wp-includes/query.php:3352
[02-May-2014 16:35:14 UTC] PHP 9. WP_Query->get_posts() /var/www/wp-includes/query.php:3246
[02-May-2014 16:35:14 UTC] PHP 10. apply_filters_ref_array() /var/www/wp-includes/query.php:3046
[02-May-2014 16:35:14 UTC] PHP 11. call_user_func_array() /var/www/wp-includes/plugin.php:256
[02-May-2014 16:35:14 UTC] PHP 12. ShareADraft->the_posts_intercept() /var/www/wp-includes/plugin.php:256
I can match PHP Stack trace: OK in vim, but I need some way for matching all lines that match PHP <some space here> <some number>.. I can match the line, but I don't know the syntax for matching all of those lines.
Try this for matching all occurrences of PHP <some space here> <some number>.
/\vPHP\s{-}\d+\.

Issue with addPath in zend framework

I'm currently reading the "Easy PHP Websites with the Zend Framework". At some point, it introduces Doctrine and gives a src code along with an text on how to install stuff properly.
I've followed all the steps correctly, but in one you have to use a "seed.php" which reads some ASINs and loads some amazon product details into the databass.
However, executing the script gives me errors, and it seems like it can't locate a file.
PHP Warning: include_once(WJG\Controller\Action\Helper\Initializer.php): failed to
open stream: No such file or directory in
C:\Programming\zend\library\Zend\L oader.php on line 134 PHP Stack
trace: PHP
1. {main}() C:\wamp\www\webclass\application\scripts\seed.php:0 PHP
2. include() C:\wamp\www\webclass\application\scripts\seed.php:9 PHP
3. Zend_Application->bootstrap() C:\wamp\www\webclass\public\cli.php:20
4. Zend_Application_Bootstrap_BootstrapAbstract->bootstrap() C:\Programmin g\zend\library\Zend\Application.php:355 PHP
5. Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap()
C:\Programmi
ng\zend\library\Zend\Application\Bootstrap\BootstrapAbstract.php:586
PHP
6.Zend_Application_Bootstrap_BootstrapAbstract->_executeResource()
C:\Pro
gramming\zend\library\Zend\Application\Bootstrap\BootstrapAbstract.php:622
PHP
7. Bootstrap->_initGlobalVars() C:\Programming\zend\library\Zend\Applicati
on\Bootstrap\BootstrapAbstract.php:669 PHP
8.Zend_Loader_Autoloader::autoload()
C:\Programming\zend\library\Zend\App
lication\Bootstrap\BootstrapAbstract.php:0 PHP
9. call_user_func() C:\Programming\zend\library\Zend\Loader\Autoloader.php :124 PHP
10.Zend_Loader_Autoloader->_autoload()
C:\Programming\zend\library\Zend\Lo ader\Autoloader.php:124 PHP
11. call_user_func()
C:\Programming\zend\library\Zend\Loader\Autoloader.php :479 PHP
12. Zend_Loader::loadClass()
C:\Programming\zend\library\Zend\Loader\Autolo ader.php:479 PHP
13. Zend_Loader::loadFile() C:\Programming\zend\library\Zend\Loader.php:82
Warning: include_once(WJG\Controller\Action\Helper\Initializer.php):
failed to o pen stream: No such file or directory in
C:\Programming\zend\library\Zend\Loader .php on line 134
Call Stack:
0.0004 651544 1. {main}() C:\wamp\www\webclass\application\scripts\see d.php:0
0.0006 661568 2. include('C:\wamp\www\webclass\public\cli.php') C:\wam
p\www\webclass\application\scripts\seed.php:9
0.0121 2052384 3. Zend_Application->bootstrap() C:\wamp\www\webclass\pu blic\cli.php:20
0.0121 2052432 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstr ap()
C:\Programming\zend\library\Zend\Application.php:355
0.0121 2052432 5. Zend_Application_Bootstrap_BootstrapAbstract->_bootst rap()
C:\Programming\zend\library\Zend\Application\Bootstrap\BootstrapAbstract.p
hp:586
0.0190 3235544 6. Zend_Application_Bootstrap_BootstrapAbstract->_execut eResource()
C:\Programming\zend\library\Zend\Application\Bootstrap\BootstrapAbst
ract.php:622
0.0190 3235768 7. Bootstrap->_initGlobalVars() C:\Programming\zend\libr
ary\Zend\Application\Bootstrap\BootstrapAbstract.php:669
0.0190 3236432 8. Zend_Loader_Autoloader::autoload() C:\Programming\zen
d\library\Zend\Application\Bootstrap\BootstrapAbstract.php:0
0.0191 3236768 9. call_user_func() C:\Programming\zend\library\Zend\Loa der\Autoloader.php:124
0.0191 3236800 10. Zend_Loader_Autoloader->_autoload() C:\Programming\ze nd\library\Zend\Loader\Autoloader.php:124
0.0191 3236848 11. call_user_func() C:\Programming\zend\library\Zend\Loa der\Autoloader.php:479
0.0191 3236880 12. Zend_Loader::loadClass() C:\Programming\zend\library\ Zend\Loader\Autoloader.php:479
0.0191 3237136 13. Zend_Loader::loadFile() C:\Programming\zend\library\Z end\Loader.php:82
PHP Warning: include_once(): Failed opening
'WJG\Controller\Action\Helper\Initi alizer.php' for inclusion
(include_path='C:\wamp\www\webclass\application/../vie
ws;.;C:\wamp\bin\php\php5.3.13\pear;c:\php\includes;C:\Programming\zend\library;
C:\wamp\bin\php\php5.3.13\pear\PEAR') in
C:\Programming\zend\library\Zend\Loader .php on line 134 PHP Stack
trace: PHP 1. {main}()
C:\wamp\www\webclass\application\scripts\seed.php:0 PHP 2. include()
C:\wamp\www\webclass\application\scripts\seed.php:9 PHP 3.
Zend_Application->bootstrap() C:\wamp\www\webclass\public\cli.php:20
PHP 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstrap()
C:\Programmin g\zend\library\Zend\Application.php:355 PHP 5.
Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap()
C:\Programmi
ng\zend\library\Zend\Application\Bootstrap\BootstrapAbstract.php:586
PHP 6.
Zend_Application_Bootstrap_BootstrapAbstract->_executeResource()
C:\Pro
gramming\zend\library\Zend\Application\Bootstrap\BootstrapAbstract.php:622
PHP 7. Bootstrap->_initGlobalVars()
C:\Programming\zend\library\Zend\Applicati
on\Bootstrap\BootstrapAbstract.php:669 PHP 8.
Zend_Loader_Autoloader::autoload()
C:\Programming\zend\library\Zend\App
lication\Bootstrap\BootstrapAbstract.php:0 PHP 9. call_user_func()
C:\Programming\zend\library\Zend\Loader\Autoloader.php :124 PHP 10.
Zend_Loader_Autoloader->_autoload()
C:\Programming\zend\library\Zend\Lo ader\Autoloader.php:124 PHP 11.
call_user_func()
C:\Programming\zend\library\Zend\Loader\Autoloader.php :479 PHP 12.
Zend_Loader::loadClass()
C:\Programming\zend\library\Zend\Loader\Autolo ader.php:479 PHP 13.
Zend_Loader::loadFile() C:\Programming\zend\library\Zend\Loader.php:82
Warning: include_once(): Failed opening
'WJG\Controller\Action\Helper\Initialize r.php' for inclusion
(include_path='C:\wamp\www\webclass\application/../views;.;
C:\wamp\bin\php\php5.3.13\pear;c:\php\includes;C:\Programming\zend\library;C:\wa
mp\bin\php\php5.3.13\pear\PEAR') in
C:\Programming\zend\library\Zend\Loader.php on line 134
Call Stack:
0.0004 651544 1. {main}() C:\wamp\www\webclass\application\scripts\see d.php:0
0.0006 661568 2. include('C:\wamp\www\webclass\public\cli.php') C:\wam
p\www\webclass\application\scripts\seed.php:9
0.0121 2052384 3. Zend_Application->bootstrap() C:\wamp\www\webclass\pu blic\cli.php:20
0.0121 2052432 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstr ap()
C:\Programming\zend\library\Zend\Application.php:355
0.0121 2052432 5. Zend_Application_Bootstrap_BootstrapAbstract->_bootst rap()
C:\Programming\zend\library\Zend\Application\Bootstrap\BootstrapAbstract.p
hp:586
0.0190 3235544 6. Zend_Application_Bootstrap_BootstrapAbstract->_execut eResource()
C:\Programming\zend\library\Zend\Application\Bootstrap\BootstrapAbst
ract.php:622
0.0190 3235768 7. Bootstrap->_initGlobalVars() C:\Programming\zend\libr
ary\Zend\Application\Bootstrap\BootstrapAbstract.php:669
0.0190 3236432 8. Zend_Loader_Autoloader::autoload() C:\Programming\zen
d\library\Zend\Application\Bootstrap\BootstrapAbstract.php:0
0.0191 3236768 9. call_user_func() C:\Programming\zend\library\Zend\Loa der\Autoloader.php:124
0.0191 3236800 10. Zend_Loader_Autoloader->_autoload() C:\Programming\ze nd\library\Zend\Loader\Autoloader.php:124
0.0191 3236848 11. call_user_func() C:\Programming\zend\library\Zend\Loa der\Autoloader.php:479
0.0191 3236880 12. Zend_Loader::loadClass() C:\Programming\zend\library\ Zend\Loader\Autoloader.php:479
0.0191 3237136 13. Zend_Loader::loadFile() C:\Programming\zend\library\Z end\Loader.php:82
PHP Fatal error: Class 'WJG_Controller_Action_Helper_Initializer' not
found in C:\wamp\www\webclass\application\Bootstrap.php on line 39 PHP
Stack trace: PHP 1. {main}()
C:\wamp\www\webclass\application\scripts\seed.php:0 PHP 2. include()
C:\wamp\www\webclass\application\scripts\seed.php:9 PHP 3.
Zend_Application->bootstrap() C:\wamp\www\webclass\public\cli.php:20
PHP 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstrap()
C:\Programmin g\zend\library\Zend\Application.php:355 PHP 5.
Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap()
C:\Programmi
ng\zend\library\Zend\Application\Bootstrap\BootstrapAbstract.php:586
PHP 6.
Zend_Application_Bootstrap_BootstrapAbstract->_executeResource()
C:\Pro
gramming\zend\library\Zend\Application\Bootstrap\BootstrapAbstract.php:622
PHP 7. Bootstrap->_initGlobalVars()
C:\Programming\zend\library\Zend\Applicati
on\Bootstrap\BootstrapAbstract.php:669
Fatal error: Class 'WJG_Controller_Action_Helper_Initializer' not
found in C:\wa mp\www\webclass\application\Bootstrap.php on line 39
Call Stack:
0.0004 651544 1. {main}() C:\wamp\www\webclass\application\scripts\see d.php:0
0.0006 661568 2. include('C:\wamp\www\webclass\public\cli.php') C:\wam
p\www\webclass\application\scripts\seed.php:9
0.0121 2052384 3. Zend_Application->bootstrap() C:\wamp\www\webclass\pu blic\cli.php:20
0.0121 2052432 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstr ap()
C:\Programming\zend\library\Zend\Application.php:355
0.0121 2052432 5. Zend_Application_Bootstrap_BootstrapAbstract->_bootst rap()
C:\Programming\zend\library\Zend\Application\Bootstrap\BootstrapAbstract.p
hp:586
0.0190 3235544 6. Zend_Application_Bootstrap_BootstrapAbstract->_execut eResource()
C:\Programming\zend\library\Zend\Application\Bootstrap\BootstrapAbst
ract.php:622
0.0190 3235768 7. Bootstrap->_initGlobalVars() C:\Programming\zend\libr
ary\Zend\Application\Bootstrap\BootstrapAbstract.php:669
This is the error, and here is the _initGlobalVars()
protected function _initGlobalVars()
{
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH.'/../library/WJG/Controller/Action/Helper');
$initializer = Zend_Controller_Action_HelperBroker::addHelper(
new WJG_Controller_Action_Helper_Initializer());
}
If you want some more info ask me, please help me because I really want to continue with the flow of the book, thanks!
You need to add prefix to the path:
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH.'/../library/WJG/Controller/Action/Helper');
add then:
Zend_Controller_Action_HelperBroker::addPrefix("WJG_Controller_Action_Helper_");
Hope this helps :)

"Cannot redeclare class" error when running PHPUnit with Code Coverage

PHPUnit seems to execute properly (appropriate tests are executed & pass), but during code coverage an error is thrown. We are using PHPUnit 3.5 with ZF 1.11. Any insight would be greatly appreciated!
(FYI: I looked at some related StackOverflow posts, but nothing seemed to solve this issue for us.)
[24-Jan-2012 00:11:09 UTC] PHP Fatal error: Cannot redeclare class Zend_View_Helper_FormSpecial in /home/za/application/modules/proposal/views/helpers/FormSpecial.php on line 23
[24-Jan-2012 00:11:09 UTC] PHP Stack trace:
[24-Jan-2012 00:11:09 UTC] PHP 1. {main}() /usr/local/zend/bin/phpunit:0
[24-Jan-2012 00:11:09 UTC] PHP 2. PHPUnit_TextUI_Command::main() /usr/local/zend/bin/phpunit:49
[24-Jan-2012 00:11:09 UTC] PHP 3. PHPUnit_TextUI_Command->run() /usr/local/zend/share/pear/PHPUnit/TextUI/Command.php:129
[24-Jan-2012 00:11:09 UTC] PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/local/zend/share/pear/PHPUnit/TextUI/Command.php:188
[24-Jan-2012 00:11:09 UTC] PHP 5. PHP_CodeCoverage_Report_HTML->process() /usr/local/zend/share/pear/PHPUnit/TextUI/TestRunner.php:363
[24-Jan-2012 00:11:09 UTC] PHP 6. PHP_CodeCoverage->getSummary() /usr/local/zend/share/pear/PHP/CodeCoverage/Report/HTML.php:128
[24-Jan-2012 00:11:09 UTC] PHP 7. PHP_CodeCoverage->processUncoveredFilesFromWhitelist() /usr/local/zend/share/pear/PHP/CodeCoverage.php:354
Thanks!
Chris
The error means that /home/za/application/modules/proposal/views/helpers/FormSpecial.php is declaring a class named Zend_View_Helper_FormSpecial which is already declared by some other module--probably .../Zend/View/Helper/FormSpecial.php in the Zend Framework. If you intended to replace Zend's FormSpecial with your own, you need to give it a different class name.
The problem is that PHP_CodeCoverage will load every PHP file in the whitelist that hasn't already been loaded. If one of those modules defines a class with the same name, you get this error.

Categories