Prestashop : Declaration of AdminLoginControllerCore::viewAccess() must be compatible with AdminControllerCore: - error-handling

I was using prestashop on hosting with no problem.
Now I started my home web server and I'm trying to get it working.
I tried many different prestashop versions and reinstalled them x times..
All the time problem is that, I can Access front panel, but not the backend panel..
All the time it shows Http 500 ERROR : Server can't Handle this request.
Now I enabled debugging and it shows me error:
Fatal error: Declaration of AdminLoginControllerCore::viewAccess() must be compatible with AdminControllerCore::viewAccess($disable = false) in C:\xampp\htdocs\Shop\controllers\admin\AdminLoginController.php on line 27
And Line
class AdminLoginControllerCore extends AdminController{
I can't understand why this is happening, becouse I haven't edited and changed any file or folder.

It happens because you have to implement a method in a child class with all parameters of a parent class method. So in your parent class viewAccess has a parameter $disable=false and you need to have it in your child viewAccess() declaration. Just put that parameter in the declaration public function viewAccess($disable=false) and you even need not use it inside. And why it was not showing on the hosting but show in a local machine it is sooner in due to different PHP versions on the servers. Because in different versions it has different error levels.

The way to fix this is simple:
go to ROOT/controllers\admin\AdminLoginController.php
al line 153 you’ll have to change
public function viewAccess() to public function viewAccess($disable = false).

I had that issue with a fresh installation of PS 1.7 yesterday but did'nt come out of it. Today, apparently the same one with PS 1.6.18, thought I was expecting it would'nt, but it seems that PS can't stand PHP 7.2.4, no matter which PS version it is (of course I should have guessed that a previous version would'nt make it better than a recent one ...). Some PHP warnings might have turned into fatal errors now. The fact is, when I went into controllers/admin/adminLoginController on line 153 and typed public function viewAccess($disable = false) instead of public function viewAccess() the blank screen went away and my back-office was there (with some remaining warnings ...). Those files would'nt have to be overwritten to allow upgrade, but anyway 1.6.18 is the last upgrade of 1.6 series... Hope it can help.

Related

LsaAddAccountRights Custom Action Returning Error Code in Windows Server 2012

I have a custom action which is used to elevate users to be able to log on as a service. This gets run during the installer. It works fine for years on every Windows operating system up until Windows Server 2012. When the below code is run on this version of Windows instead of getting a long back of 0 for success I get a different error code back.
LsaAddAccountRights(
IntPtr PolicyHandle,
IntPtr AccountSid,
LSA_UNICODE_STRING[] UserRights,
long CountOfRights)
The problem is the code appears to be different every time and is a very large number, e.g. 102938473.
I run the error code through the following method to get the error code but this returns a different large number which doesn't appear to be a valid error code.
LsaNtStatusToWinError(long status)
I have tried looking these error codes up, but with no luck. They seem to be randomly generated and nonsensical.
If I ignore the returned error code, It appears that the user is successfully allowed to log on as a service. So everything appears to be working, except I am getting an error code back. I could ignore this error code, but what happens when it is a valid error, I may ignore it in the future.
Extra Information
I can run the code that is in the Custom action fine on its own in a console application without error. Only when it is part of the wix installer it seems not to work.
I'd take a look at the WiX Util extensions's User element. The name attribute can be a property. Using the CreateUser, LogonAsService and UpdateIfExists attributes you can take an existing account and grant it the rights. Or perhaps you have more code that you can refactor.
Issue could be with the return type of LsaAddAccountRights in C#.
I was able to solve the issue by changing the return type of LsaAddAccountRights in C# from long to UInt32. Found this information here . This change must be done for LsaNtStatusToWinError and LsaClose as well.

Delphi Clipboard and Graphics DCU's Missing

I have this weird thing that keeps happening when trying to use the following unit:
XLSReadWriteII 5
Every time I add one of their components to my form and compile it, it gives me the following error:
[dcc32 Fatal Error] Unit1.pas(16): F1026 File not found: 'C:\Users\Gordon\Documents\RAD Studio\Projects\grdi\Clipbrd.dcu'
This tells me that there is no DCU's in my API, no I get the same error on my windows 7 and my windows 8 pc's. Delphi was installed from the embarcadero website via their installer.
If I download a clipboard.dcu and .pas file and run it again it gives me the same error saying Graphics.duc is missing...
I have emailed the company Axolot Data (the creators of XLSReadWrite 5) with regards to this issue, they just keep telling me my API is corrupt, on both pc's??
However what I find strange is that their supplied samples run.
How can I fix this?
I think I have found a solution or reason this is happening.
XLSReadWrite 5 is a VCL component which references the VCL API, im using FMX.
The package was designed for VCL and not FMX but for some reason shows up in the FMX Units.
Strange but that might be my cause

"Access denied" error on 'rename' call when uploading files in Symfony

I'm working on a Symfony project in a Win7/Apache 2.2/ZendStudio environment and I have some trouble getting my file uploads to work properly.
My goal is to let the user create a new entity which can contain arbitrary many "Documents" (based on the article found at http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html). I have a form type containing one field of type 'collection' (based on the article found at http://symfony.com/doc/current/cookbook/form/form_collections.html). So far so good. Via jQuery I can add arbitrarily many forms as subforms which works fine. But when I submit my form, very often (but not always!) I get the following exception:
Warning: rename(C:/Programming/Servers/Apache2.2/htdocs/Symfony/app/cache/dev/doctrine/orm/Proxies\__CG__MyMainBundleEntityRecruiter.php.507bf02e30df69.85090364,C:/Programming/Servers/Apache2.2/htdocs/Symfony/app/cache/dev/doctrine/orm/Proxies\__CG__MyMainBundleEntityLecture.php): Zugriff verweigert (code: 5) in C:\Programming\Servers\Apache2.2\htdocs\Symfony\vendor\doctrine\orm\lib\Doctrine\ORM\Proxy\ProxyFactory.php line 194
Zugriff verweigert is German for Access denied. Weirdly, the files seem to get renamed and saved at the right location nevertheless.
Why do I get this exception, does it have something to do with my environment and how can I fix it? I guess this issue is related to Symfony Warning : rename (../app/cache/dev , ../app/cache/dev_old ) : Access Denied . (Code : 5), but not quite sure whether it's the same as it happens in another context. I do also encounter the problem described in this link, though.
Thanks in advance.
I've been running into the same exact issue recently. I don't really have a good sense of why the problem is happening, but the problem is coming from a step in the process where Doctrine is trying to generate proxy classes.
In my config.yml file, under the ORM section of the Doctrine configuration, I changed the value of auto_generate_proxy_classes from %kernel.debug% to false. I've played with it for a while since making the change and haven't been able to reproduce the issue since.
Found this while looking for same answer, it seems to be a windows + Doctrine issue.
Doctrine Ticket with more detailed info
TLDR: Basically the proxy is trying to rename a file that's still being used, works in Linux but not always on windows.
Go to the file that renames the file, then replace it with a windows compatible rename function
private function renameWindowsCompatible($oldfile,$newfile) {
try {
rename($oldfile,$newfile);
} catch(\Exception $e) {
if (copy($oldfile,$newfile)) {
unlink($oldfile);
return TRUE;
}
return FALSE;
}
return TRUE;
}
I learned about proxies and saw that it is used with lazy loading.
I had an entity A with a one to one relationship to B.
B was the problem is the proxies directory
I just had fetch="EAGER" annotation in A entity
/**
#ORM\OneToOne(targetEntity=B::class, fetch="EAGER")
*/
private $b;
Then the B proxy was not generated and no more problem with rename.
Hope this help.

Why is Mage_Persistent breaking /api/wsdl?soap

I get the following error within Magento CE 1.6.1.0
Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /home/dev/env/var/www/user/dev/wdcastaging/lib/Zend/Controller/Response/Abstract.php:586) in /home/dev/env/var/www/user/dev/wdcastaging/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 119
when accessing /api/soap/?wsdl
Apparently, a session_start() is being attempted after the entire contents of the WSDL file have already been output, resulting in the error.
Why is magento attempting to start a session after outputting all the datums? I'm glad you asked. So it looks like controller_front_send_response_after is being hooked by Mage_Persistent in order to call synchronizePersistentInfo(), which in turn ends up getting that session_start() to fire.
The interesting thing is that this wasn't always happening, initially the WSDL loaded just fine for me, initially I racked my brains to try and see what customization may have been made to our install to cause this, but the tracing I've done seems to indicate that this is all happening entirely inside of core.
We have also experienced a tiny bit of (completely unrelated) strangeness with Mage_Persistent which makes me a little more willing to throw my hands up at this point and SO it.
I've done a bit of searching on SO and have found some questions related to the whole "headers already sent" thing in general, but not this specific case.
Any thoughts?
Oh, and the temporary workaround I have in place is simply disabling Mage_Persistent via the persistent/options/enable config data. I also did a little bit of digging as to whether it might be possible to observe an event in order to disable this module only for the WSDL controller (since that seems to be the only one having problems), but it looks like that module relies exclusively on this config flag to determine it's enabled status.
UPDATE: Bug has been reported: http://www.magentocommerce.com/bug-tracking/issue?issue=13370
I'd report this is a bug to the Magento team. The Magento API controllers all route through standard Magento action controller objects, and all these objects inherit from the Mage_Api_Controller_Action class. This class has a preDispatch method
class Mage_Api_Controller_Action extends Mage_Core_Controller_Front_Action
{
public function preDispatch()
{
$this->getLayout()->setArea('adminhtml');
Mage::app()->setCurrentStore('admin');
$this->setFlag('', self::FLAG_NO_START_SESSION, 1); // Do not start standart session
parent::preDispatch();
return $this;
}
//...
}
which includes setting a flag to ensure normal session handling doesn't start for API methods.
$this->setFlag('', self::FLAG_NO_START_SESSION, 1);
So, it sounds like there's code in synchronizePersistentInf that assumes the existence of a session object, and when it uses it the session is initialized, resulting in the error you've seen. Normally, this isn't a problem as every other controller has initialized a session at this point, but the API controllers explicitly turns it off.
As far as fixes go, your best bet (and probably the quick answer you'll get from Magento support) will be to disable the persistant cart feature for the default configuration setting, but then enable it for specific stores that need it. This will let carts
Coming up with a fix on your own is going to be uncharted territory, and I can't think of a way to do it that isn't terribly hacky/unstable. The most straight forward way would be a class rewrite on the synchronizePersistentInf that calls it's parent method unless you've detected this is an API request.
This answer is not meant to replace the existing answer. But I wanted to drop some code in here in case someone runs into this issue, and comments don't really allow for code formatting.
I went with a simple local code pool override of Mage_Persistent_Model_Observer_Session to exit out of the function for any URL routes that are within /api/*
Not expecting this fix to need to be very long-lived or upgrade-friendly, b/c I'm expecting them to fix this in the next release or so.
public function synchronizePersistentInfo(Varien_Event_Observer $observer)
{
...
if ($request->getRouteName() == 'api') {
return;
}
...
}

Undefined method stdClass::user() error when using CakePHP Auth

I'm fairly new to CakePHPand am building a site using the Auth component. A couple of times I have tried to do things with this component which have caused the error
Fatal error: Call to undefined method stdClass::user() in /ftphome/site/app/controllers/users_controller.php on line 395
The line it refers to in this case is
$this->User->read(null, $this->Auth->user('id'));
This error does not disappear when I revert the code back to how it was before the error and I only seem to be able to get rid of it by removing some files on the server (I'm not sure which files, when I tried removing all files in the tmp directory the error persisted so I removed the entire site and restored from the latest svn revesion.
In this particular case I think I caused the error by putting the following code in app_controller
class AppController extends Controller {
function beforeRender() {
$this->set('test', $this->Auth->user());
}
}
Which I copied from this thread http://groups.google.com/group/cake-php/browse_thread/thread/ee9456de93d2eece/cff6fe580d13622b?lnk=gst&q=auth
A previous time I caused the issue by attempting to update the Auth user details after updating the user in the database.
I can see I'm somehow removing the user object from the Auth object but I can't understand why I need to delete files in the site to get it back or how the code above removes it - any help would be much appreciated.
Edit
It looks like in the case I mentioned above, the problem was the app_controller.php file which I'd copied into my app/controllers directory. Just having the file with an empty class declaration causes this error - can anyone provide further insight?
Further edit
I've realised I've been a bit silly and the problem was caused by me putting app_controller.php in /app/controllers/app_controller.php when there was already one in /app/app_controller.php - thanks for the input though Andy, it helps me understand a bit more what was happening.
This error is normally thrown when a class instance (in your case an instance of Auth) has been serialised to disk, then re-read/deserialised in another request but the class definition (i.e. Auth) has not been loaded yet, so PHP creates it as an "stdClass" (standard class.)
When you remove your site files, you're removing the session storage (IIRC it's the Cache folder in a CakePHP app) so at the next request, a new session is created from scratch.
It's been a while since I last used CakePHP (I switched to Zend) so I cannot remember if Cake includes files it requires using an __autoload function or not.
On that mailing list post, someone says that you can this $this->Auth->user() in a view, but in the controller, you can use $session->read('Auth.User') to get the user component. Not sure what the difference is, maybe $this->Auth is a view helper, so isn't available in the controller?