Sometimes on my website (ZendFramework2), I get an error when setting a session variable.
The error:
PHP Fatal error: Uncaught exception 'Zend\\Stdlib\\Exception\\InvalidArgumentException' with message 'The iterator class does not exist' in /MySite/vendor/zendframework/zendframework/library/Zend/Stdlib/ArrayObject/PhpReferenceCompatibility.php:374
Stack trace:
#0 /MySite/vendor/zendframework/zendframework/library/Zend/Stdlib/ArrayObject/PhpReferenceCompatibility.php(414): Zend\\Stdlib\\ArrayObject\\PhpReferenceCompatibility->setIteratorClass(NULL)
#1 [internal function]: Zend\\Stdlib\\ArrayObject\\PhpReferenceCompatibility->unserialize('a:4:{s:7:"stora...')
#2 /MySite/vendor/zendframework/zendframework/library/Zend/Session/SessionManager.php(95): session_start()
#3 /MySite/vendor/zendframework/zendframework/library/Zend/Session/AbstractContainer.php(78): Zend\\Session\\SessionManager->start()
#4 /MySite/module/Application/Module.php(97): Zend\\Session\\AbstractContainer->__construct('site')
#5 [internal function]: Application\\Module->onBootstrap(Object(Zend\\Mvc\\MvcEvent))
#6 /MySite/vendor/zendframework/zendframework/library/Zend/Stdlib/ArrayObject/PhpReferenceCompatibility.php on line 374
Code Module.php line 97 :
$s_site = new \Zend\Session\Container('site');
I try but I can not find why. Do you have any idea? Need more informations?
Thank you.
The is a result of the setIteratorClass method in ArrayObject/PhpReferenceCompatibility being passed a null $class argument. I'm not sure why it sometimes gets a null, but the way I fixed it in my case was to set the iterator class as 'ArrayIterator' when passed a null object, like this:
if (!isset($class)) {
$class = 'ArrayIterator';
}
In the latest zf2 version, the ArrayObject/PhpReferenceCompatibility class has been removed, so please make the change in stdlib/ArrayObject.php.
Related
**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.
I downloaded and installed neo4j-php-client and neo4j 2.3.2. Actually all works fine, but I just wondering why there is no error handlers in this php client? For example if there is an error in cypher query, no error has throwing to be easy to catch it. I searching through the network, but I can't found a solution.
Do anybody have an idea how to turn on error handlers?
Thanks in advance.
I'm the maintainer of neo4j-php-client.
When you send a query to Neo4j, it is actually sent via Guzzle.
Of course there is a try/catch block for handling exceptions, which is located here :
https://github.com/graphaware/neo4j-php-client/blob/master/src/HttpClient/GuzzleHttpClient.php#L76
If there is an error in your cypher query, an exception will be thrown of course, the exception is of type Neo4jException (https://github.com/graphaware/neo4j-php-client/blob/master/src/Exception/Neo4jException.php)
Here is a simple code with a cypher syntax error and you can see an exception is thrown :
<?php
require_once __DIR__ .'/vendor/autoload.php';
use Neoxygen\NeoClient\ClientBuilder;
$client = ClientBuilder::create()
->addConnection('default', 'http', 'localhost', 7474)
->setAutoFormatResponse(true)
->build();
$query = 'MATCH (n) RETURN x';
$result = $client->sendCypherQuery($query)->getResult();
-
ikwattro#graphaware ~/d/g/p/neo4j-php-client> php test.php
PHP Fatal error: Uncaught Neoxygen\NeoClient\Exception\Neo4jException: Neo4j Exception with code "Neo.ClientError.Statement.InvalidSyntax" and message "Variable `x` not defined (line 1, column 18 (offset: 17))
"MATCH (n) RETURN x"
^" in /Users/ikwattro/dev/graphaware/php/neo4j-php-client/src/Extension/AbstractExtension.php:117
Stack trace:
#0 /Users/ikwattro/dev/graphaware/php/neo4j-php-client/src/Extension/AbstractExtension.php(104): Neoxygen\NeoClient\Extension\AbstractExtension->checkResponseErrors(Array)
#1 /Users/ikwattro/dev/graphaware/php/neo4j-php-client/src/Extension/NeoClientCoreExtension.php(98): Neoxygen\NeoClient\Extension\AbstractExtension->handleHttpResponse(Object(Neoxygen\NeoClient\Request\Response))
#2 [internal function]: Neoxygen\NeoClient\Extension\NeoClientCoreExtension->sendCypherQuery('MATCH (n) RETUR...')
#3 /Users/ikwattro/dev/graphaware/php/neo4j-php-client/src/Extension/ExtensionManager.php(53): call_user_func_array(Array, Array)
#4 /Users/ikwattro/dev/graphaware/php/neo4j-php-cli in /Users/ikwattro/dev/graphaware/php/neo4j-php-client/src/Extension/AbstractExtension.php on line 117
Fatal error: Uncaught Neoxygen\NeoClient\Exception\Neo4jException: Neo4j Exception with code "Neo.ClientError.Statement.InvalidSyntax" and message "Variable `x` not defined (line 1, column 18 (offset: 17))
"MATCH (n) RETURN x"
^" in /Users/ikwattro/dev/graphaware/php/neo4j-php-client/src/Extension/AbstractExtension.php:117
Stack trace:
#0 /Users/ikwattro/dev/graphaware/php/neo4j-php-client/src/Extension/AbstractExtension.php(104): Neoxygen\NeoClient\Extension\AbstractExtension->checkResponseErrors(Array)
#1 /Users/ikwattro/dev/graphaware/php/neo4j-php-client/src/Extension/NeoClientCoreExtension.php(98): Neoxygen\NeoClient\Extension\AbstractExtension->handleHttpResponse(Object(Neoxygen\NeoClient\Request\Response))
#2 [internal function]: Neoxygen\NeoClient\Extension\NeoClientCoreExtension->sendCypherQuery('MATCH (n) RETUR...')
#3 /Users/ikwattro/dev/graphaware/php/neo4j-php-client/src/Extension/ExtensionManager.php(53): call_user_func_array(Array, Array)
#4 /Users/ikwattro/dev/graphaware/php/neo4j-php-cli in /Users/ikwattro/dev/graphaware/php/neo4j-php-client/src/Extension/AbstractExtension.php on line 117
Thanks for the answer. The problem is seems on my end, I figured out after few tests - Error hanldering overwrites by the php framework.
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.
I making a small site and decided to use Valitron library for the validation part of my site. I noticed there is no kind of "unique" method that returns whether a passed value already exists in the database or not. I quickly added this method, but not like it is recommended to do. I added this:
protected function validateUnique($field, $value, $table)
{
$model = new Model();
return $model->unique($table[0], $field, $value);
}
to the main Validator class. The thing is, it is working, but only with one field. If I use this on 2 or more fields in my validation proccess, I get this error
Fatal error: Uncaught exception 'RedBeanPHP\RedException' with message 'A database has already be specified for this key.' in C:\dev\htdocs\Shop\vendor\gabordemooij\redbean\RedBeanPHP\Facade.php:295 Stack trace: #0 C:\dev\htdocs\Shop\vendor\gabordemooij\redbean\RedBeanPHP\Facade.php(216): RedBeanPHP\Facade::addDatabase('default', 'mysql:host=127....', 'root', '', false) #1 C:\dev\htdocs\Shop\app\libs\Model.php(18): RedBeanPHP\Facade::setup('mysql:host=127....', 'root', '') #2 C:\dev\htdocs\Shop\vendor\vlucas\valitron\src\Valitron\Validator.php(429): Shop\libs\Model->__construct() #3 [internal function]: Valitron\Validator->validateUnique('email', 'email.example#g...', Array) #4 C:\dev\htdocs\Shop\vendor\vlucas\valitron\src\Valitron\Validator.php(885): call_user_func(Array, 'email', 'email.example#g...', Array) #5 C:\dev\htdocs\Shop\app\controllers\AuthController.php(68): Valitron\Validator->validate() #6 [internal function]: Shop\controllers\AuthController->postRegister() #7 C:\dev\htdocs\Shop\app\libs\Bootstrap.php(64): in C:\dev\htdocs\Shop\vendor\gabordemooij\redbean\RedBeanPHP\Facade.php on line 295
I work with RedBean as well as Valitron for the first time and I'm not able to say what causes the problem.
I got the same error.
A database has already be specified for this key. in /var/www/html...
I have already setup one database and want to connect another database then I used R::addDatabase() function to add new databse and R::selectDatabase() function to select that database.
code is
define('dsn2', 'pgsql:host=localhost;dbname=mydb';
R::addDatabase('DB2', dsn2, 'dbusers', 'dbpasss');
R::selectDatabase('DB2');
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.