Symfony2 - Doctrine:generate:crud - Routing error - caching

I'm using Symfony2 RC3 and I have a NewsBundle that has an Article entity.
I generated crud for it using the command: $ php app/console doctrine:generate:crud (with 'write' set to yes).
Now, every page on my site throws this error:
Fatal error: Label 'not_admin_article_create' already defined in /usr/local/zend/apache2/htdocs/AIEF/app/cache/prod/appprodUrlMatcher.php on line 260
If i get rid of
requirements: { _method: post }
for admin_article_create, admin_article_update and admin_article_delete in the generated routing yml file, everything works fine. Any idea why ?

I came across a similar issue recently, Google search wasn't much help but give me ideas of where to look, anyways enough blah blah.
The error I was getting was as follows:
enter code here`Fatal error: Label 'not _ offering management' already defined in /...
Whats I noticed was that there was a duplicate entry in routing_dev.yml and routing.yml, so basically the issue pops up when you happen to have multiple configurations. I think Symfony2 bundle generation adds mapping, but user probably accidental re-configures mapping else where.

Related

Prestashop 1.7.6.5 not taking into account php module modifications

I've been modifying a module and for some reason prestashop does not take into consideration the code modifications in module.php.
I've made modifications a while back and I need to modify it again due to an update that raises an error, the problem is that I get the error even if I remove said line.
I get this type of error: PHP message: PHP Notice: Undefined index: ordersorderFilter!active in /modules/module/module.php on line 104
I've commented first than removed that line but I still get the error.
It seems like there is a cache somewhere that I can't find, I've deactivated all possible cache in prestashop, activated debug mode, deleted the dev and prod folders in /var/cache/ but I still get the error.
I've used grep on the server to try to find that line, and when I delete it from the file I can not find it anywhere else on the server (but can find it if I add it).
Anybody has any idea?
Thanks a lot!
Prestashop does not perform any kind of caching on the modules PHP files so the problem lies elsewhere or at "lower level" (webserver / proxy ie.).
So check your environment for server-side caching, proxies or PHP accelerators such as opCache that may not serve changes from the source server.
Also try renaming or deleting the offending file altogether and see if the error changes, if not you might simply be looking at the wrong file :)

Sulu, strange hash related error when trying to save page / post?

Until recently everything was working well. Now, when I try to save (create or update) any page or post I get error message at top of the form "Error - There was an error when trying to save the form".
In error log I see this error:
“Uncaught PHP Exception Sulu\Component\Rest\Exception\InvalidHashException: “The given hash for the entity of type “Sulu\Bundle\ArticleBundle\Document\ArticleDocument” with the id “9e0720a7-5565-4a6f-a735-8a186b8fef9b” does not match the current hash. The entity has probably been edited in the mean time.” at /var/www/html/vendor/sulu/sulu/src/Sulu/Component/Hash/RequestHashChecker.php line 53"
Tried clearing symfony cache, website cache from admin, restarting docker containers.
I'm totally unaware that I did something to cause this error. Please help.
Update: strange thing I just noticed. When I try to save some article and I get that error and go back to overview page (where i.e. all articles of that type are listed) then I see unchanged article title. But when I click to edit it I see changed title?!? Like title on overview page and title on edit page are not used from the same place? How is that possible?
Update:
Now even I setup once more project from scratch saving articles causes that error. Some more info:
In stack trace last command executed is:
in vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/StaticNoPingConnectionPool.php (line 64)
an it shoots out “No alive nodes found in your cluster”.
And while I'm setting up the project when executing:
php bin/console ongr:es:index:create
I get error:
{"error":{"root_cause":[{"type":"resource_already_exists_exception","reason
":"index [su_articles/sWs5F1uzSFO8bFiZqF1Egw] already exists","index_uuid":
"sWs5F1uzSFO8bFiZqF1Egw","index":"su_articles"}],"type":"resource_already_e
xists_exception","reason":"index [su_articles/sWs5F1uzSFO8bFiZqF1Egw] alrea
dy exists","index_uuid":"sWs5F1uzSFO8bFiZqF1Egw","index":"su_articles"},"st
atus":400}
And when I run:
php bin/console ongr:es:index:create --manager=live
I get similar:
In Connection.php line 675:
{"error":{"root_cause":[{"type":"resource_already_exists_exception","reason":"index [su_articles_live/Pissm9ycRj-o79K4wrrD
AA] already exists","index_uuid":"Pissm9ycRj-o79K4wrrDAA","index":"su_articles_live"}],"type":"resource_already_exists_exc
eption","reason":"index [su_articles_live/Pissm9ycRj-o79K4wrrDAA] already exists","index_uuid":"Pissm9ycRj-o79K4wrrDAA","i
ndex":"su_articles_live"},"status":400}
Also to mention that now saving pages works, but saving articles doesn't.
This solved the issue on ElasticSearch index creation for me:
php bin/console ongr:es:index:drop --force
The error can happen in the following cases.
Expected Case somebody else did edit the same article like you and did save it
Unexpected Case your phpcr cache is not in sync
Unexpected Case you have a multi server setup but your cache.app is not configured to use a central cache
So if its one of the unexpected cases first you should clear your cache.pools with:
bin/console cache:pool:prune
If you have a multi server setup make sure you configure a central cache. Most use in this case a redis-server which you configure in your cache.yaml e.g.:
# config/packages/prod/cache.yaml
framework:
cache:
default_redis_provider: "%env(resolve:REDIS_DSN)%"
app: cache.adapter.redis
Also make sure that you use the latest version and maybe update your phpcr cache configuration based on the sulu/skeleton: https://github.com/sulu/skeleton/blob/2.x/config/packages/prod/sulu_document_manager.yaml, there you could when performance doesn't matter in your case disable the phpcr cache, I would not recommend that.

Error getting valid response from API. Check log file for error details

I cant seem to find the error log of authorize.net api.
I have Laravel application which uses "authorizenet/authorizenet" package and the code where I try to create a customer profile, I get following error:
"Error getting valid response from API. Check log file for error details"
Can anyone tell me whereto find these logs? and what it's name?
I tried in /var/logs folder but i cant seem to find it.
if someone else has this issue, here is the solution.
The authorize.net has changed their endpoints from https://api.authorize.net to https://api2.authorize.net which is one of the possible reasons that you might get this error.
So if you are hardcoding these endpoints in your code then update it to the new one or if you are using library constant for it, same as me:
\net\authorize\api\constants\ANetEnvironment::SANDBOX
\net\authorize\api\constants\ANetEnvironment::PRODUCTION
Then simply update your library by running:
composer update authorizenet/authorizenet
This is how I resolved it and it seems to be the best way so far because it will update their library to take everything up to date if they have changes something else and you started experiencing this issue.
I hope it helps

Can't clear cache Symfony in production

Despite of all my attempts to understand the problem, I still can't figure out what is happening.
I developped a website with Symfony 2.7 which perfectly works in dev mode. When I tested it in production mode, an error 500 is returned.
The exception is :
Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException:
"Error: Call to a member function getCacheFactory() on a non-object" at
/home/admdev-php/public_html/sfSUAPS/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 3039
{"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 0):
Error: Call to a member function getCacheFactory() on a non-object at
/home/admdev-php/public_html/sfSUAPS/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:3039)"} []
So I've tried to clear the cache and I had the same message :
[Symfony\Component\Debug\Exception\FatalErrorException]
Compile Error: require(): Failed opening required
'/home/stagiaire/workspace/suaps/app/cache/prod/doctrine/orm/Proxies/__CG__AppBundleEntityPlace.php'
(include_path='.:/usr/share/php:/usr/share/pear')`
I've tried to clear doctrine's cache but this doesn't solve the problem.
There are severals roles : One for students, one for teachers and one for admins. I only get this error when my role is student. So I looked closer to methods which are concerned and I commented everything related to studies and it worked. So I think the error is linked with my Entity Repository since "findBy" and "findAll" are failing.
I've took a look into Symfony's code but the error seems to be on my side. I really don't know what is going on, thank you if you can help me.
Problem solved
Turns out someone used an entity directly from cache...
Turns out someone used an entity directly from cache...
use Proxies\__CG__\AppBundle\Entity\Place;

I can't enable or disable modules. I'm getting "An error occurred while saving this configuration"

I have a new fairly fresh install of Magento 1.7.0.2. I installed two custom payment method modules that are working fine. But now whenever I try to disable or enable any Payment Method or Shipping Method it gives me an error like this:
An error occurred while saving this configuration: Warning:
preg_match() expects parameter 2 to be string, array given in
/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php
on line 57
Do you have any idea why?
EDIT 2:
I found the problem. It was caused by a patch I applied to fix to a previous BUG. :P
EDIT:
So I disabled all custom modules and I was still getting the same error. I logged what was happening and it seems that some core modules are sending an array to be saved.
Like PayPal Express Checkout for instance. One of the config options is the Time of Day in the SFTP credentials for Settlement Report Settings. It's composed by three different drop-downs and it's sending an array to be saved!
In the Shipping Methods, UPS has a config options called Allowed Methods, and it's also sending an array!
I still don't know why it wasn't happening before and now it is. They shouldn't be encrypting everything. Any clues?
I had the same issue, its a known bug, try this around line no. 135 on code/core/mage/Adminhtml/model/config/data.php
// add this code
$backendClass=false;
if (isset($fieldConfig->backend_model)) {
$backendClass = $fieldConfig->backend_model;
} // before this
if (!$backendClass) {
$backendClass = 'core/config_data';
}
This actually is a reported bug in Magento that seems to affect encrypted config settings (passwords, API keys, etc.).
http://www.magentocommerce.com/bug-tracking/issue?issue=14217
Try disabling the first of the modules, log out of the admin panel, clear /var/cache and see if the problem still exists. If it does, do the same with the second module.
The problem should be gone. Now that you know which module causes the problems you can either decide to try another module instead or debug to see whats going wrong.
Put a breakpoint on line 57 in /app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Encrypted.php to see what goes wrong. It seems that the second parameter is not a string (might be null for example due to wrong configuration or something) when its given to the preg_match function. Maybe this helps you to identify the problem.
Regards
Disabling modules through the back office isn't a good idea as it only disables the block output, if you would like to disable a module you should go to app/etc/modulesand there you should find Module_Name.xmlfile - in this file just put false in active node.

Resources