I'm new to cakephp and following this tutorial for a user authentication system
http://bakery.cakephp.org/articles/SeanCallan/2007/04/17/simple-form-authentication-in-1-2-x-x
The only thing I changed is in the file login.ctp. I changed the pointers from
$form->
to
$this->Form->
I'm getting two errors and I can't figure out why. Here is the first
Warning (2): Illegal offset type [CORE\Cake\Model\Model.php, line 2603]
This is the code/context it displays
if ($type !== 'all') {
if ($this->findMethods[$type] === true) {
$type = array(
'username' => '',
'password' => '*****'
)
$query = array(
'conditions' => null,
'fields' => null,
'joins' => array(),
'limit' => null,
'offset' => null,
'order' => null,
'page' => (int) 1,
'group' => null,
'callbacks' => true,
(int) 0 => 'id',
(int) 1 => 'username'
)
$this = object(User) {}
This information was also displayed
Model::buildQuery() - CORE\Cake\Model\Model.php, line 2603
Model::find() - CORE\Cake\Model\Model.php, line 2562
User::validateLogin() - APP\Model\User.php, line 9
UsersController::login() - APP\Controller\UsersController.php, line 21
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE\Cake\Controller\Controller.php, line 484
Dispatcher::_invoke() - CORE\Cake\Routing\Dispatcher.php, line 104
Dispatcher::dispatch() - CORE\Cake\Routing\Dispatcher.php, line 86
[main] - APP\webroot\index.php, line 96
Here is the second error
Warning (2): Illegal offset type [CORE\Cake\Model\Model.php, line 2579]
This is the code it displays
return $results;
} else {
if ($this->findMethods[$type] === true) {
$type = array(
'username' => '',
'password' => '*****'
)
$query = array(
'conditions' => null,
'fields' => null,
'joins' => array(),
'limit' => null,
'offset' => null,
'order' => array(
),
'page' => (int) 1,
'group' => null,
'callbacks' => true,
(int) 0 => 'id',
(int) 1 => 'username'
)
$results = array(
(int) 0 => array(
)
)
$this = object(User) {}
Here is the additional information
Model::find() - CORE\Cake\Model\Model.php, line 2579
User::validateLogin() - APP\Model\User.php, line 9
UsersController::login() - APP\Controller\UsersController.php, line 21
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE\Cake\Controller\Controller.php, line 484
Dispatcher::_invoke() - CORE\Cake\Routing\Dispatcher.php, line 104
Dispatcher::dispatch() - CORE\Cake\Routing\Dispatcher.php, line 86
[main] - APP\webroot\index.php, line 96
I would suggest you follow the more recent tutorial at
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
Which should follow your setup exactly since you are using cakephp 2.1. The one you are trying to follow now is for cakephp1.2 and was written on 2007 so I doubt it's going to be useful for you.
Related
I have a PrestaShop 1.7.5 and have upgraded recently PayPal to version 5.4.0
seems the update has broken the payments
the PayPal pop up is displaying and then I get the error message
Error code: 0;Short message: The value of a field does not conform to the expected format.;
I have found this topic
https://www.prestashop.com/forums/topic/1038873-issues-with-paypal-v531/?do=findComment&comment=3292187
but after changing the rouding numbers form 3 to 2 I get agin an error from PayPal
Error code: 0;Short message: The value of a field is either too short or too long.;
can anyone help?
(1/1) ContextErrorException
Notice: Trying to get property 'id' of non-object
in custompopup.php line 386
at CustomPopup->functionHook(array('smarty' => object(SmartyDevTemplate), 'cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 2))in custompopup.php line 83
at CustomPopup->__call('hookdisplayFooter', array(array('smarty' => object(SmartyDevTemplate), 'cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 2)))in Hook.php line 966
at HookCore::coreCallHook(object(CustomPopup), 'hookdisplayFooter', array('smarty' => object(SmartyDevTemplate), 'cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 2))in Hook.php line 351
at HookCore::callHookOn(object(CustomPopup), 'displayFooter', array('smarty' => object(SmartyDevTemplate), 'cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 2))in Hook.php line 903
at HookCore::exec('displayFooter', array('smarty' => object(SmartyDevTemplate), 'cookie' => object(Cookie), 'cart' => object(Cart), 'altern' => 2), null)in smarty.config.inc.php line 165
at smartyHook(array('h' => 'displayFooter'), object(SmartyDevTemplate))in SmartyLazyRegister.php line 83
at SmartyLazyRegister->__call('smartyHook', array(array('h' => 'displayFooter'), object(SmartyDevTemplate)))in 5debc5491c55490fb70872b4b8ac73e7c4b076d5_2.file.footer.tpl.php line 92
at Block_261192810604657b04b0269_01194600->callBlock(object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 248
at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_261192810604657b04b0269_01194600), object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 184
at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_261192810604657b04b0269_01194600))in smarty_internal_runtime_inheritance.php line 156
at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_261192810604657b04b0269_01194600', 'hook_footer')in 5debc5491c55490fb70872b4b8ac73e7c4b076d5_2.file.footer.tpl.php line 39
at content_604657b04b3ee8_66053338(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123
at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114
at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216
at Smarty_Internal_Template->render()in smarty_internal_template.php line 385
at Smarty_Internal_Template->_subTemplateRender('file:_partials/footer.tpl', null, 'layouts/layout-full-width.tpl', 0, 3600, array(), 0, false)in e8aae06b74c347ba1d8da54e2a9d5a9f73bac7c7_2.module.paypalviewstemplatesfront.php line 163
at Block_1467223895604657b03129d9_88778906->callBlock(object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 248
at Smarty_Internal_Runtime_Inheritance->callBlock(object(Block_1467223895604657b03129d9_88778906), object(SmartyDevTemplate))in smarty_internal_runtime_inheritance.php line 184
at Smarty_Internal_Runtime_Inheritance->process(object(SmartyDevTemplate), object(Block_1467223895604657b03129d9_88778906))in smarty_internal_runtime_inheritance.php line 156
at Smarty_Internal_Runtime_Inheritance->instanceBlock(object(SmartyDevTemplate), 'Block_1467223895604657b03129d9_88778906', 'footer')in e8aae06b74c347ba1d8da54e2a9d5a9f73bac7c7_2.module.paypalviewstemplatesfront.php line 99
at content_604657b0314b23_85855752(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123
at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114
at Smarty_Template_Compiled->render(object(SmartyDevTemplate))in smarty_internal_template.php line 216
at Smarty_Internal_Template->render(false, 0)in smarty_internal_templatebase.php line 232
at Smarty_Internal_TemplateBase->_execute(object(SmartyDevTemplate), null, 'layouts/layout-full-width.tpl', null, 0)in smarty_internal_templatebase.php line 116
at Smarty_Internal_TemplateBase->fetch('module:paypal/views/templates/front/payment_error.tpl', null, 'layouts/layout-full-width.tpl', null, false, true, false)in SmartyDev.php line 40
at SmartyDev->fetch('module:paypal/views/templates/front/payment_error.tpl', null, 'layouts/layout-full-width.tpl')in FrontController.php line 682
at FrontControllerCore->smartyOutputContent('module:paypal/views/templates/front/payment_error.tpl')in FrontController.php line 666
at FrontControllerCore->display()in Controller.php line 301
at ControllerCore->run()in Dispatcher.php line 509
at DispatcherCore->dispatch()in index.php line 28
I am new to codeigniter I am trying to save my record into the database and when ever I try to do so it gives me this error.
Fatal error: Uncaught ActiveRecord\UndefinedPropertyException: Undefined property: Product->Array in C:\xampp\htdocs\cafe\sparks\php-activerecord\0.0.2\vendor\php-activerecord\lib\Model.php on line 514 in C:\xampp\htdocs\cafe\sparks\php-activerecord\0.0.2\vendor\php-activerecord\lib\Model.php:514 Stack trace: #0 C:\xampp\htdocs\cafe\sparks\php-activerecord\0.0.2\vendor\php-activerecord\lib\Model.php(333): ActiveRecord\Model->read_attribute('Array') #1 C:\xampp\htdocs\cafe\sparks\php-activerecord\0.0.2\vendor\php-activerecord\lib\Validations.php(573): ActiveRecord\Model->__get('Array') #2 C:\xampp\htdocs\cafe\sparks\php-activerecord\0.0.2\vendor\php-activerecord\lib\Validations.php(141): ActiveRecord\Validations->validates_uniqueness_of(Array) #3 C:\xampp\htdocs\cafe\sparks\php-activerecord\0.0.2\vendor\php-activerecord\lib\Model.php(1048): ActiveRecord\Validations->validate() #4 C:\xampp\htdocs\cafe\sparks\php-activerecord\0.0.2\vendor\php-activerecord\lib\Model.php(784): ActiveRecord\Model->_validate() #5 C:\xampp\htdocs in C:\xampp\htdocs\cafe\sparks\php-activerecord\0.0.2\vendor\php-activerecord\lib\Model.php on line 514
The code I have wrote works fine for other models. Here is the code I am using.
$data = array(
"type" => $this->input->post('type'),
"code" => $this->input->post('code'),
"name" => $this->input->post('name'),
"category" => $this->input->post('category'),
"cost" => $this->input->post('cost'),
"description" => $this->input->post('description'),
"tax" => $this->input->post('tax'),
"alertqt" => $this->input->post('alertqt'),
"price" => $this->input->post('price'),
"color" => $this->input->post('color'),
"supplier" => $this->input->post('supplier'),
"unit" => $this->input->post('unit'),
"taxmethod" => $this->input->post('taxmethod'),
"options" => $this->input->post('options'),
"photo" => $image,
"photothumb" => $image_thumb,
"created_at" => $date,
"modified_at" => $date
);
$product = Product::create($data);
I have solved it the issue was not in the controller but it was in the model. I was validating uniqueness of array but actually it was not needed. Removing that block of code works fine.
I have installed OroCommerce, a Symfony2 based application. I want to have the 'vendor' directory on a higher level outside the users directory. I followed the steps at http://symfony.com/doc/current/configuration/override_dir_structure.html#override-the-vendor-directory but now the namespaces can't be found. I get the following error:
InvalidArgumentException in YamlFileLoader.php line 399: There is no extension able to load the configuration for "framework" (in /home/oro2/public_html/app/config/config_dev.yml). Looked for namespace "framework", found "web_profiler", "sensio_distribution", "debug"
in YamlFileLoader.php line 399
at YamlFileLoader->validate(array('imports' => array(array('resource' => 'config.yml')), 'framework' => array('router' => array('resource' => '%kernel.root_dir%/config/routing_dev.yml'), 'profiler' => array('only_exceptions' => false)), 'web_profiler' => array('toolbar' => true, 'intercept_redirects' => false), 'monolog' => array('handlers' => array('main' => array('type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', 'level' => 'debug'))), 'oro_assetic' => array('css_debug' => null, 'css_debug_all' => false), 'oro_message_queue' => array('client' => array('traceable_producer' => true))), '/home/oro2/public_html/app/config/config_dev.yml') in YamlFileLoader.php line 369
at YamlFileLoader->loadFile('/home/oro2/public_html/app/config/config_dev.yml') in YamlFileLoader.php line 44
at YamlFileLoader->load('/home/oro2/public_html/app/config/config_dev.yml', null) in DelegatingLoader.php line 45
at DelegatingLoader->load('/home/oro2/public_html/app/config/config_dev.yml') in AppKernel.php line 35
at AppKernel->registerContainerConfiguration(object(DelegatingLoader)) in bootstrap.php.cache line 2776
at Kernel->buildContainer() in bootstrap.php.cache line 2728
at Kernel->initializeContainer() in OroKernel.php line 290
at OroKernel->initializeContainer() in bootstrap.php.cache line 2507
at Kernel->boot() in OroKernel.php line 252
at OroKernel->boot() in bootstrap.php.cache line 2538
at Kernel->handle(object(Request)) in app_dev.php line 33
Am I forgetting something? Does anyone know how to solve this problem?
You are somewhere calling %kernel.root_dir%/config/routing_dev.yml which actually does not exist, because you have moved the config file dir
I have a symfony2 appliciation. We have previously set up a docker-compose stack for development, and this is why we want all its configuration to bet set via environment variables instead of the parameters.yml.
Hence I replaced the content of my parameters.yml from:
parameters:
locale: 'en'
secret: 'SOME_SECURITY_TOKEN'
...
to:
parameters:
locale: '%locale%'
secret: '%secret%'
...
My docker-compose.yml file contains:
my_app:
hostname: my-app
build: .
dockerfile: Dockerfile.dev
ports:
- "9080:80"
- "9043:433"
environment:
LOCALE: en
SECRET: SOME_SECURITY_TOKEN
...
Yet after rebuilding my container I get the exception:
ParameterCircularReferenceException in ParameterBag.php line 209: Circular reference detected for parameter "secret" ("secret" > "secret").
1. in ParameterBag.php line 209
2. at ParameterBag->resolveString('%secret%', array('secret' => true)) in ParameterBag.php line 185
3. at ParameterBag->resolveValue('%secret%', array('secret' => true)) in ParameterBag.php line 214
4. at ParameterBag->resolveString('%secret%', array('secret' => true)) in ParameterBag.php line 185
5. at ParameterBag->resolveValue('%secret%', array()) in ParameterBag.php line 175
6. at ParameterBag->resolveValue(array('secret' => '%secret%', 'router' => array('resource' => '%kernel.root_dir%/config/routing.yml', 'strict_requirements' => null), 'form' => null, 'csrf_protection' =>
null, 'validation' => array('enable_annotations' => true), 'templating' => array('engines' => array('twig')), 'default_locale' => '%locale%', 'trusted_hosts' => null, 'trusted_proxies' => null,
'session' => array('handler_id' => 'api.session.handler.memcached'), 'fragments' => null, 'http_method_override' => true), array()) in ParameterBag.php line 175
7. at ParameterBag->resolveValue(array(array('secret' => '%secret%', 'router' => array('resource' => '%kernel.root_dir%/config/routing.yml', 'strict_requirements' => null), 'form' => null,
'csrf_protection' => null, 'validation' => array('enable_annotations' => true), 'templating' => array('engines' => array('twig')), 'default_locale' => '%locale%', 'trusted_hosts' => null,
'trusted_proxies' => null, 'session' => array('handler_id' => 'api.session.handler.memcached'), 'fragments' => null, 'http_method_override' => true), array('router' =>
array('resource' => '%kernel.root_dir%/config/routing_dev.yml', 'strict_requirements' => true), 'profiler' => array('only_exceptions' => false)))) in MergeExtensionConfigurationPass.php line 45
8. at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in MergeExtensionConfigurationPass.php line 39
9. at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in Compiler.php line 107
10. at Compiler->compile(object(ContainerBuilder)) in ContainerBuilder.php line 589
11. at ContainerBuilder->compile() in bootstrap.php.cache line 2687
12. at Kernel->initializeContainer() in bootstrap.php.cache line 2465
13. at Kernel->boot() in bootstrap.php.cache line 2496
14. at Kernel->handle(object(Request)) in app_dev.php line 30
Yet in my container I do see the env variables:
le-container:/var/www/my-app# env
SECRET=SOME_SECURITY_TOKEN
LOCALE=en
What am I doing wrong and how to fix it?
For some reason, adding a prefix to my environment variable fixed the issue:
parameters:
locale: '%foo_locale%'
secret: '%foo_secret%'
and of course whenever the variable is set as well. My current working theory is that symfony doesn't like having the same parameter name and env variable, yet I am not sure.
parameters:
locale: '%locale%'
secret: '%secret%'
Is useless construction, locale and secret already is parameters. Just remove this block.
There is a solution to use external parameters. Prefix your variables with "SYMFONY__". In your case it would be:
my_app:
...
environment:
SYMFONY__APP__LOCALE: en
SYMFONY__APP__SECRET: SOME_SECURITY_TOKEN
...
And in your parameters you can call it as followed:
parameters:
locale: %app.locale%
secret: %app.secret%
im working in SmFony Project but i got some issues when i would get access on my poject via this URL : http://localhost/oksa-depannage/web/app_dev.php/login
"OKSA-DEPANNAGE" is a project name.
So i hope that my question is clear
Errors :
in C:\wamp\www\oksa-depannage\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag.php line 106
at ParameterBag->get('java_path') in C:\wamp\www\oksa-depannage\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag.php line 232
at ParameterBag->resolveString('%java_path%', array()) in C:\wamp\www\oksa-depannage\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag.php line 203
at ParameterBag->resolveValue('%java_path%', array()) in C:\wamp\www\oksa-depannage\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag.php line 193
at ParameterBag->resolveValue(array('debug' => '%kernel.debug%', 'use_controller' => false, 'bundles' => array('OksaTemplateBundle'), 'java' => '%java_path%', 'filters' => array('cssrewrite' => null, 'yui_css' => array('jar' => '%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar'), 'yui_js' => array('jar' => '%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar'))), array()) in C:\wamp\www\oksa-depannage\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag.php line 193
at ParameterBag->resolveValue(array(array('debug' => '%kernel.debug%', 'use_controller' => false, 'bundles' => array('OksaTemplateBundle'), 'java' => '%java_path%', 'filters' => array('cssrewrite' => null, 'yui_css' => array('jar' => '%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar'), 'yui_js' => array('jar' => '%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar'))), array('use_controller' => true))) in C:\wamp\www\oksa-depannage\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass.php line 44
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in C:\wamp\www\oksa-depannage\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass.php line 39
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in C:\wamp\www\oksa-depannage\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Compiler\Compiler.php line 117
at Compiler->compile(object(ContainerBuilder)) in C:\wamp\www\oksa-depannage\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\ContainerBuilder.php line 619
at ContainerBuilder->compile() in C:\wamp\www\oksa-depannage\app\bootstrap.php.cache line 2491
at Kernel->initializeContainer() in C:\wamp\www\oksa-depannage\app\bootstrap.php.cache line 2270
at Kernel->boot() in C:\wamp\www\oksa-depannage\app\bootstrap.php.cache line 2301
at Kernel->handle(object(Request)) in C:\wamp\www\oksa-depannage\web\app_dev.php line 28
thanks for your helps.
Looks like symfony is trying to start the yui compressor, which is a java library.
This post has a workaround to make this situation work on windows: symfony2 assetics yui compressor on windows (path syntax)