AnchorCMS installation fails - php

When I've gone through the installation steps for Anchor CMS, I'm getting an error (after final step):
Uncaught Exception
Undefined variable: vars
Origin
install/routes.php on line 183
Trace
#0 /home/.../anchor-cms/install/routes.php(183): System\error::native(8, 'Undefined varia...', '/home/...', 183, Array)
#1 [internal function]: {closure}()
#2 /home/.../anchor-cms/system/route.php(165): call_user_func_array(Object(Closure), Array)
#3 /home/.../anchor-cms/system/router.php(158): System\route->run()
#4 /home/.../anchor-cms/system/start.php(46): System\router->dispatch()
#5 /home/.../anchor-cms/install/index.php(33): require('/home/...')
#6 {main}
Any suggestions? I'm running Linux 64bit (elementaryOS).

You may have already resolved this, but the way I got around this was to remove the undefined variable from line 183 of the install/routes.php file completely.
return Layout::create('account' $vars);
So it then looked like this:
return Layout::create('account');
Refreshing the page will then allow you to create an account and login to the admin interface etc.

Related

Gdex woocommerce installation issue?

I have newly installed GDEX woommerce plugin on wordpress I have this issue
Fatal error: Uncaught InvalidArgumentException: Token is required. in F:\xampp\htdocs\wordpress\bug\wp-content\plugins\mygdex-for-woocommerce\includes\class-gdex-api.php:32 Stack trace: #0 F:\xampp\htdocs\wordpress\bug\wp-content\plugins\mygdex-for-woocommerce\includes\helpers.php(324): Gdex_Api->__construct('') #1 F:\xampp\htdocs\wordpress\bug\wp-content\plugins\mygdex-for-woocommerce\admin\class-gdex-consignment.php(348): gdex_api_get_last_shipment_status(Array) #2 F:\xampp\htdocs\wordpress\bug\wp-includes\class-wp-hook.php(289): Gdex_Consignment->fetch_consignments_statuses(Array) #3 F:\xampp\htdocs\wordpress\bug\wp-includes\plugin.php(249): WP_Hook->apply_filters(Array, Array) #4 F:\xampp\htdocs\wordpress\bug\wp-includes\class-wp-query.php(3190): apply_filters_ref_array('the_posts', Array) #5 F:\xampp\htdocs\wordpress\bug\wp-includes\class-wp-query.php(3448): WP_Query->get_posts() #6 F:\xampp\htdocs\wordpress\bug\wp-includes\class-wp.php(624): WP_Query->query(Array) #7 F:\xampp\htdocs\wordpress\bug\wp-includes\class-w in F:\xampp\htdocs\wordpress\bug\wp-content\plugins\mygdex-for-woocommerce\includes\class-gdex-api.php on line 32
You need to insert user access from https://my.gdexpress.com/dashboard/updateprofile

Any way to mask a "Fatal Error" on a REST API and instead give a user-friendly error message?

I'm working on a REST API that I can use on my current and future projects for the Company. I'm not new in PHP but my knowledge of it is also not that much.
So currently, I'm trying to simulate a possible error both when an invalid query or a non-existing function is being called. I've tried several snippets such as here, here, here, and here - but none of them worked for me. It still throws a generic error that shows the entire stack trace, a portion of the query where the error occurred, file and line number of where the error was encountered. I know and I have read that Fatal Errors are not supposed to be caught by any try/catch block even with Throwable Exceptions but I would still rather not throw such information that could lead to a possible security vulnerability.
Below is a sample of the Fatal Error message I encountered that the try/catch block was not able to record:
<br />
<b>Fatal error</b>: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION
test_api_db.VERSIONs does not exist in C:\xampp\htdocs\my-api\app\services\v1\test\test_1_route.service.php:29
Stack trace:
#0 [internal function]: PDOStatement->execute()
#1 [internal function]: Phalcon\Db\Adapter\Pdo->executePrepared(Object(PDOStatement), Array, Array)
#2 [internal function]: Phalcon\Db\Adapter\Pdo->query('SELECT VERSIONs...', NULL, NULL)
#3 [internal function]: Phalcon\Db\Adapter->fetchOne('SELECT VERSIONs...', 4, NULL)
#4 C:\xampp\htdocs\my-api\app\services\v1\test\test_1_route.service.php(29):
Phalcon\Db\Adapter->fetchColumn('SELECT VERSIONs...')
#5 C:\xampp\htdocs\my-api\app\routes\v1\test\test_1_route.php(57):
myAPI\App\Services\v1\Test\Test1RouteService->GetDbVersion()
#6 [internal function]: Closure->myAPI\App\Routes\v1\Test\{closure}()
#7 C:\xampp\htdocs\my-api\index.php(55): Phalcon\Mvc\Micro->handle()
#8 {main}
thrown in <b>C:\xampp\htdocs\my-api\app\services\v1\test\test_1_route.service.php</b on line <b>29</b><br />
Error#Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION test_api_db.VERSIONs does not exist in C:\xampp\htdocs\my-api\app\services\v1\test\test_1_route.service.php:29
Stack trace:
#0 [internal function]: PDOStatement->execute()
#1 [internal function]: Phalcon\Db\Adapter\Pdo->executePrepared(Object(PDOStatement), Array, Array)
#2 [internal function]: Phalcon\Db\Adapter\Pdo->query('SELECT VERSIONs...', NULL, NULL)
#3 [internal function]: Phalcon\Db\Adapter->fetchOne('SELECT VERSIONs...', 4, NULL)
#4 C:\xampp\htdocs\my-api\app\services\v1\test\test_1_route.service.php(29): Phalcon\Db\Adapter->fetchColumn('SELECT VERSIONs...')
#5 C:\xampp\htdocs\my-api\app\routes\v1\test\test_1_route.php(57): myAPI\App\Services\v1\Test\Test1RouteService->GetDbVersion()
#6 [internal function]: Closure->myAPI\App\Routes\v1\Test\{closure}()
#7 C:\xampp\htdocs\my-api\index.php(55): Phalcon\Mvc\Micro->handle()
#8 {main}
thrown<br>Line#29<br>File#C:\xampp\htdocs\my-api\app\services\v1\test\test_1_route.service.php<br>
If it helps, I'm using PhalconPHP (3.4.3) on PHP (7.3.0) as it provides me all the things I need to start working on an API with what little knowledge I have.
Fatal errors in php 7.x are not Exceptions but they're instances of Throwable.
Instead of catching Exception you can catch Throwable and return an error message.

Fatal error: Uncaught Error: Call to undefined method stdClass::option();

**Fatal error: Uncaught Error: Call to undefined method stdClass::option() in
C:\xampp\htdocs\newtest\wordpress\wp-content\plugins\theme_support_meson\includes\helpers\taxonomies.php:19
Stack trace: #0
C:\xampp\htdocs\newtest\wordpress\wp-content\plugins\theme_support_meson\includes\loader.php(55):
Bunch_Taxonomies->__construct() #1
C:\xampp\htdocs\newtest\wordpress\wp-content\plugins\theme_support_meson\includes\loader.php(77):
_load_plugins_class('taxonomies', 'helpers', false) #2 C:\xampp\htdocs\newtest\wordpress\wp-includes\class-wp-hook.php(286):
_bunch_plugin_init('') #3 C:\xampp\htdocs\newtest\wordpress\wp-includes\class-wp-hook.php(310):
WP_Hook->apply_filters(NULL, Array) #4
C:\xampp\htdocs\newtest\wordpress\wp-includes\plugin.php(465):
WP_Hook->do_action(Array) #5
C:\xampp\htdocs\newtest\wordpress\wp-settings.php(505):
do_action('init') #6
C:\xampp\htdocs\newtest\wordpress\wp-config.php(90):
require_once('C:\\xampp\\htdocs...') #7
C:\xampp\htdocs\newtest\wordpress\wp-load.php(37):
require_once('C:\\xampp\\htdocs.. in
C:\xampp\htdocs\newtest\wordpress\wp-content\plugins\theme_support_meson\includes\helpers\taxonomies.php
on line 19**
This Error occurs when I am including new theme in my WordPress account. That time I am using meson theme and try to include new theme and suddenly this error occurs. so guide me on what to do for solving this.
Deactivate all plugins associated with the last theme, I can see that the error caused by theme_support_meson plugin so make sure to deactivate it then delete it.

Yii2 REST API not working properly

I am creating an API for get user by YII2 user api by user id. If I pass user id then it is working good but If I pass string then I get below error.
<pre>An Error occurred while handling another error:
yii\base\InvalidParamException: Response content must not be an array. in /var/www/html/vendor/yiisoft/yii2/web/Response.php:1020
Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/web/Response.php(313): yii\web\Response->prepare()
#1 /var/www/html/vendor/yiisoft/yii2/web/ErrorHandler.php(128): yii\web\Response->send()
#2 /var/www/html/vendor/yiisoft/yii2/base/ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException))
#3 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))
#4 {main}
Previous exception:
yii\base\InvalidRouteException: Unable to resolve the request: categories/wewqewqe in /var/www/html/vendor/yiisoft/yii2/base/Controller.php:127
Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction('wewqewqe', Array)
#1 /var/www/html/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module->runAction('categories/wewq...', Array)
#2 /var/www/html/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(yii\web\Request))
#3 /var/www/html/index.php(16): yii\base\Application->run()
#4 {main}
Next yii\web\NotFoundHttpException: Page not found. in /var/www/html/vendor/yiisoft/yii2/web/Application.php:114
Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(yii\web\Request))
#1 /var/www/html/index.php(16): yii\base\Application->run()
#2 {main}</pre>
I am using swagger for executing APIs and Endpoint of the API is
users/{id}
Work fine when enter
/users/1
Get error when
/users/asdf
Web.php
'users/<id:\d+>' => 'users/',
I have recently faced same issue and it has been solved by the change in routing in web.php in config folder.
Change your url
users/<id> instead of users/<id:\d+>.

How to make zf2 output errors with simple formatting?

I am newbie with zf2 framework. For example, now I get this error:
Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (ZfcUserOverride) could not be initialized.' in F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php:189 Stack trace:
#0 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(163): Zend\ModuleManager\ModuleManager->loadModuleByName(Object(Zend\ModuleManager\ModuleEvent))
#1 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(90): Zend\ModuleManager\ModuleManager->loadModule('ZfcUserOverride')
#2 [internal function]: Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent))
#3 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(468): call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent))
#4 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('loadModules', Object(Zend\ModuleManager\ModuleEvent), NULL)
#5 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(109): Zend\EventManager\EventManager->trigger('loadModules', Object(Zend\ModuleManager\ModuleManager), Object(Zend\ModuleManager\ModuleEvent))
#6 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(252): Zend\ModuleManager\ModuleManager->loadModules()
#7 F:\Server\domains\zf2-skeleton\public\index.php(17): Zend\Mvc\Application::init(Array)
#8 {main} thrown in F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php on line 189
I formatted it manually, so you can read correct error.
It is hard to do it all time I get some error. How I can make zf2 to output such errors correctly?
I need something like this:
The ZendSkeletonApplication comes with a template that reports errors in a readable format. If you install the ZendSkeletonApplication and build your application off of it, you’ll benefit from this template and other conveniences. Alternatively, you can use just the standard error template or create your own.

Categories