Cryptic PHP error invloving Zend Framework and Doctrine - apache

I'm currently receiving the following error message with Zend Framework and Doctrine. I'm trying to figure out how to solve this issue..
Fatal error: Uncaught exception 'LogicException' with message 'Passed array does not specify an existing static method (class 'Doctrine' does not have a method 'modelsAutoload')' in /home/bellalun/library/Smallunch/lib/Bootstrap.php:173 Stack trace: #0 /home/bellalun/library/Smallunch/lib/Bootstrap.php(173): spl_autoload_register(Array) #1 /etc/ZendFramework/1.9.0/Zend/Application/Bootstrap/BootstrapAbstract.php(660): Bootstrap->_initDoctrine() #2 /etc/ZendFramework/1.9.0/Zend/Application/Bootstrap/BootstrapAbstract.php(613): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('doctrine') #3 /etc/ZendFramework/1.9.0/Zend/Application/Bootstrap/BootstrapAbstract.php(577): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL) #4 /etc/ZendFramework/1.9.0/Zend/Application.php(324): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap() #5 /home/bellalun/application/bootstrap.php(14): Zend_Application->bootstrap() #6 /home/bellalun/public_html/dev.php(8): require('/home/bellalun/...') #7 {main} thrown in /home/bellalun/library/Smallunch/lib/Bootstrap.php on line 173
Here's what's on line 173
$this->getApplication()->getAutoloader()
->pushAutoloader(array('Doctrine', 'autoload'));
spl_autoload_register(array('Doctrine', 'modelsAutoload'));
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
My hosting company made some changes over the weekend that messed up a few of my sites, taking them down. They switched me from Apache to LiteSpeed and my PHP handler from DSO to SuPHP. Not sure if this is related or not..

I don't use Doctrine, but the code sample you've posted doesn't make a lot of sense. On the first line you're registering Doctrine's autoload function with the ZF autoloader. This looks good, and seems to match this tutorial. On the next line, you're registering another autoloader with SPL directly (this is bad), and doing so using another, apparently non-existent function (modelsAutoload). Since this is the line that's erroring I'd guess commenting that line out will fix your problem.

Related

Yii2 - Migrating test database

I'm using codeception and I'm trying to run the migration for the test database.
From inside the tests folder I run the command
php codeception/bin/yii migrate/up --interactive=0
but I'm getting the error
Exception 'yii\base\InvalidConfigException' with message 'The configuration for the "user" component must contain a "class" element.'
in /www/shopboxyii-v2/vendor/yiisoft/yii2/di/ServiceLocator.php:205
Stack trace:
#0 /www/shopboxyii-v2/vendor/yiisoft/yii2/di/ServiceLocator.php(261): yii\di\ServiceLocator->set('user', Array)
#1 /www/shopboxyii-v2/vendor/yiisoft/yii2/base/Component.php(180): yii\di\ServiceLocator->setComponents(Array)
#2 /www/shopboxyii-v2/vendor/yiisoft/yii2/BaseYii.php(546): yii\base\Component->__set('components', Array)
#3 /www/shopboxyii-v2/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(yii\console\Application), Array)
#4 /www/shopboxyii-v2/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#5 /www/shopboxyii-v2/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
#6 /www/shopboxyii-v2/tests/codeception/bin/yii(25): yii\console\Application->__construct(Array)
#7 {main}
Does anyone know anything about this error or what's causing it??
You don't need the user component configuration in the console/config/main.php (if using advanced-app) or app/config/web.php (if using basic-app), you should just remove the component configurations and it will start working seamlessly.

Prestashop Maintenance mode error

First things first I am new to Prestashop.
I have two issues. First is when I'm in the maintenance mode and I add my ip adres to gain access, I still can't access my frontoffice. This gives server error in my Chrome Browser.
But the bigger issue is when I turn the Maintenance mode off (and deleting my IP adress from the list) There is nothing. Just a blank screen. After a little research I found how to turn the error reporting on in defines.inc.php like this:
/* Debug only */
define('_PS_MODE_DEV_', true);
After this I got this error(s):
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/home/.sites/78/site58/web/modules/categoriesbar/category-bar-level.tpl" on line 8 "{include file=$tpl_dir./category-tree-branch.tpl node=$child last='true'}" - Unexpected "/", expected one of: "{" , "$" , "identifier" , INTEGER' in /home/.sites/78/site58/web/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:665 Stack trace: #0 /home/.sites/78/site58/web/tools/smarty/sysplugins/smarty_internal_templateparser.php(3144): Smarty_Internal_TemplateCompilerBase->trigger_template_error() #1 /home/.sites/78/site58/web/tools/smarty/sysplugins/smarty_internal_templateparser.php(3209): Smarty_Internal_Templateparser->yy_syntax_error(40, '/') #2 /home/.sites/78/site58/web/tools/smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(40, '/') #3 /home/.sites/78/site58/web/tools/smarty/sysplugins/smarty_internal_t in /home/.sites/78/site58/web/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 665
any help would be appreciated :)
P.S.
I upgraded the Prestashop from 1.2.x to the 1.5.4 version...
Maybe it has something to do with this?
The error tells you there is an error in the template. Try changing the line to
{include file="$tpl_dir./category-tree-branch.tpl" node=$child last='true'}

Some PHP errors/notices not displaying call stack information within Slim Framework

I'm using the Slim Framework.
Most PHP errors in my application output normal PHP error messages
Example code with an error that outputs the Call Stack:
echo 'missing semicolon at eol'
Error Output:
Parse error: syntax error, unexpected T_IF, expecting ',' or ';' in /data/www/app/routes/companies_routes.php on line 737
Call Stack:
0.0002 637144 1. {main}() /data/www/html/index.php:0
But other errors ( maybe just notices ) output a limited message that doesn't have a line number, file name, or call stack. This makes debugging these errors extremely time consuming.
Code with an error that outputs a limited error message
echo $an_undefined_variable;
Limited Message
Undefined variable: an_undefined_variable
I can't figure out what's going on. I've never had this problem before. I suspect it has something to do with the way Slim handles PHP errors. I've tried wrapping these errors in Try/Catch blocks, but that doesn't solve the problem.
The problem is that Slim is handling exceptions itself ( some sort of default behavior I've yet to track down ).
I've got my code wrapped in Try/Catch blocks, so when Slim catches a PHP error, it's throwing it's own Exception that I'm then outputting in my Catch block. If I remove my Catch block, Slim them outputs it's own complete error message that contains the stack as usual.
This surely means I'm not using Slim quite right, but that's a different question.

How can can I save my php created pdf file on a specific directory?

I need to convert a dynamic web page to pdf... So as a start, I use this code for practice,
This works fine as long as I use the directory c:/test.php. But everytime I change the directory to something like d:/xampp/htdocs/test.php I get the error message:
Fatal error: Uncaught exception 'PDFlibException' with message 'pdf_begin_document() expects exactly 3 parameters, 2 given' in D:\xampp\htdocs\mypdftest\pdf_file.php:1… Stack trace: #0 D:\xampp\htdocs\mypdftest\pdf_file.php(1… pdf_begin_document(Resource id #2, 'test.pdf') #1 {main} thrown in D:\xampp\htdocs\mypdftest\pdf_file.php on line 18
Please tell me what's going wrong and how to fix it... Any help is appreciated...
Read the documentation on this one. It seems that the function pdf_begin_document() accepts 3 mandatory parameters, which are:
PDF_begin_document($pdfdoc, $filename, $optlist );
where $optlist is an option list (not much documentation here), like this example:
$optlist = "destination={page=1 type=fixed zoom=1 top=100 left=50}";

How to upload image on elgg using rest url?

I am trying to athenticate from the elgg local server.
by refering
http://www.danielansari.com/wordpress/2008/12/how-to-use-the-rest-api-in-elgg-11/
I am getting following error:
Status: **** ERROR (-1) ****
Message: Method call 'login' has not been implemented.
Result: exception 'APIException' with message 'Method call 'login' has not been implemented.' in C:\xampp\htdocs\elgg1.6.1\engine\lib\api.php:562
Stack trace:
#0 C:\xampp\htdocs\elgg1.6.1\services\api\rest.php(46): execute_method()
#1 C:\xampp\htdocs\elgg1.6.1\engine\lib\api.php(1219): include('C:\xampp\htdocs...')
#2 C:\xampp\htdocs\elgg1.6.1\engine\lib\pagehandler.php(42): api_endpoint_handler('login', Array, '')
#3 C:\xampp\htdocs\elgg1.6.1\engine\handlers\pagehandler.php(23): page_handler(Array, 'api')
#4 {main}
Basically my aim is to upload an image in a community made by using ELGG. But In this place only I am stuck.
How to solve it?
Well, I can't help you with that exception, but I can tell you that there is no way directly in Elgg's REST API to upload an image. I tried doing this and had to replicate the logic of the upload.php action in my own huge honking function.