Post by Sammyskills » Fri May 03, 2019 7:19 pm

Hi,

I recently upgraded my store from version 3.0.2.0 to the latest 3.0.3.0, without overwriting the config.php and admin/config.php files. Now, when I log in to my admin area, it shows a 404 page not found error.

Before the upgrade, mails were not been sent out to customers (upon registration) and also an admin (when an order is placed). I also found out that if I click on the Modification menu, under Extensions, it returns a 404 page not found error, likewise when I try to update some settings via System>>Settings. So, I felt upgrading to the latest version would resolve all the issues.

But now, I can't even view the admin page. It is returning a 404 error.

User avatar
Newbie

Posts

Joined
Tue Aug 06, 2013 4:19 pm


Post by straightlight » Fri May 03, 2019 7:50 pm

Check your error / server access logs regarding the 404 error codes. Since you don't have access to the admin (or partial access), you can also look in your storage/logs folder for your error logs.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Sammyskills » Fri May 03, 2019 9:03 pm

Thanks for the reply.

I have checked through the storage folder: storage/logs/error.log and there are a lot of errors I see there:

Code: Select all

2019-05-03 10:57:47 - PHP Warning:  sizeof(): Parameter must be an array or an object that implements Countable in /home/****/storage/modification/admin/controller/common/dashboard.php on line 12
What could be the cause of this error + how do I resolve it?

User avatar
Newbie

Posts

Joined
Tue Aug 06, 2013 4:19 pm


Post by straightlight » Fri May 03, 2019 9:10 pm

See if the same issue can be reproduced with OC v3.0.3.2 in a test environment. I haven't seen this report as a frequent incident on the forum. Also, which PHP version are you using?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Sammyskills » Fri May 03, 2019 9:39 pm

I have been able to resolve the admin login issue. It was a php version problem.

I downgraded to version 7.0, now I can log in to the store admin.

But the former problem is still there:
  • When I click on Extensions >> Modification, it returns a 404 error page
  • When I click on System >> Settings, and save, it returns a 404 error page
What can I do??

User avatar
Newbie

Posts

Joined
Tue Aug 06, 2013 4:19 pm


Post by straightlight » Fri May 03, 2019 9:50 pm

What can I do??
Check your error logs!

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Sammyskills » Fri May 03, 2019 9:53 pm

Where exactly?

public_html/error.log is empty.
public_html/admin/error.log is also empty.

Where else can I check?

User avatar
Newbie

Posts

Joined
Tue Aug 06, 2013 4:19 pm


Post by straightlight » Fri May 03, 2019 10:06 pm

Sammyskills wrote:
Fri May 03, 2019 9:53 pm
Where exactly?

public_html/error.log is empty.
public_html/admin/error.log is also empty.

Where else can I check?
This post already mentions where else to check: viewtopic.php?f=199&t=211540#p754061

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Sammyskills » Fri May 03, 2019 10:09 pm

The storage >> logs >> error.log is also empty.

Is there a place I'm missing?

User avatar
Newbie

Posts

Joined
Tue Aug 06, 2013 4:19 pm


Post by straightlight » Fri May 03, 2019 10:43 pm

Check your server access logs in your FTP root folder under: access_logs or the logs folder. Recent activities should be listed there. If not, check your host console under the logs icon. Forum rules.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Sammyskills » Sat May 04, 2019 4:40 pm

I've checked all the logs you mentioned, but nothing seems to point out where the error is coming from.

So, I decided to do a fresh install in a sub-directory. After the installation, when I click on System >> Settings and click on the "Save" button, it returns a 404 page not found error.

I have PHP 7 installed in my server.

Please, is there something my server is missing that could be causing this error?

User avatar
Newbie

Posts

Joined
Tue Aug 06, 2013 4:19 pm


Post by straightlight » Sat May 04, 2019 8:59 pm

So far, it looks like an SSL configuration issue or from your .htaccess file. You can either contact your host to get this resolved or create a new service request in the Commercial Support section of the forum to get this issue fixed as a custom job.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by IP_CAM » Sat May 04, 2019 9:19 pm

This countable problem has been seen before, it's some
routine, not yet made work with PHP v.7.2x in some Versions.
I had it once in this (model/module/module.php) File:

Code: Select all

foreach($modules as $module){
foreach($module as $array){
//   if(count($array[0]) > 0 && is_array($array)){
if (is_array($array) && count($array[0]) > 0) {
for($i = 0; $i<count($array[0]); $i++){
if( isset($array[0][$i]['layout_id']) ){
$ms[$array[0][$i]['layout_id']][] = array("name"=> $module['name'], "position" => $array[0][$i]['position']);
}
}
}
}
}
Google is full of it.
https://php.net/manual/en/function.count.php
viewtopic.php?t=210541
https://themeforest.net/item/journal-ad ... s?page=462
https://stackoverflow.com/questions/523 ... t-implemen

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by straightlight » Sun May 05, 2019 2:24 am

Code: Select all

foreach($modules as $module){
foreach($module as $array){
//   if(count($array[0]) > 0 && is_array($array)){
if (is_array($array) && count($array[0]) > 0) {
for($i = 0; $i<count($array[0]); $i++){
if( isset($array[0][$i]['layout_id']) ){
$ms[$array[0][$i]['layout_id']][] = array("name"=> $module['name'], "position" => $array[0][$i]['position']);
}
}
}
}
}
should be changed to:

Code: Select all

$ms = array();

foreach($modules as $module) {
    foreach($module as $array) {
        if (!empty($array[0]) && is_array($array[0])) {
   	    foreach ($array[0] as $module_value) {
		if (!empty($module_value['layout_id'])) {
			$ms[$module_value['layout_id']][] = array('name'				=> $module['name'],
												  		 'position'			=> $module_value['position'],
												 		);
		}
	}
}
}
}
Last edited by straightlight on Sun May 05, 2019 4:44 am, edited 1 time in total.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by IP_CAM » Sun May 05, 2019 4:42 am

By use of the above, everything tested worked, it even told me, that an 'orphan' file still
resides in the Admin Module Section. But going back to Home, that's, what I got, in the
last (new) code line left curly '}' of the File.
Image
Last edited by IP_CAM on Sun May 05, 2019 4:44 am, edited 1 time in total.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by straightlight » Sun May 05, 2019 4:44 am

Missing ended bracket. Code fixed on the above.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by IP_CAM » Sun May 05, 2019 7:37 am

Well done! :D I still don't know, what purpose this file serves. It was
part of PEKU's OC2 Theme to 1.5.6.x Mod and EDGE Version, and it
failed to work with PHP-7.x, as it came by PEKU default, that's, why
I know, that it exists ... :D
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by straightlight » Sun May 05, 2019 11:32 am

The reason why this code was obviously failing was due to the genius who did this with a count / sizeof function without validating the array knowing if it's empty or not before verifying if the get type was an array as the count / sizeof function is not a necessity in this case.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by IP_CAM » Sun May 05, 2019 1:12 pm

It was not the only one, later OC-Versions had the same problem,
after moving up in PHP Version. And I at least found a Solution. :D
Colorblind Coders have to take n'use, what exists, regardless of, if
it comes in light-brown or dark-green Color, as long as it works ... :laugh:
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by nightwing » Sun May 24, 2020 11:49 pm

I momentarily get these errors as well, being logged like 40 times in a 2 minute span.

Code: Select all

2020-05-24 5:19:32 - PHP Warning: count(): Parameter must be an array or an object that implements Countable in /public_html/system/library/template/Twig/Extension/Core.php on line 1266
In that file I have:

Code: Select all

// add multibyte extensions if possible
if (function_exists('mb_get_info')) {
    /**
     * Returns the length of a variable.
     *
     * @param Twig_Environment $env   A Twig_Environment instance
     * @param mixed            $thing A variable
     *
     * @return int The length of the value
     */
    function twig_length_filter(Twig_Environment $env, $thing)
    {
        return is_scalar($thing) ? mb_strlen($thing, $env->getCharset()) : count($thing);
    }
Hi Straight is it possible that it could be the same senario as module.php that you resolved above?

Regards,
Night

Active Member

Posts

Joined
Tue Nov 05, 2019 11:08 pm

Who is online

Users browsing this forum: No registered users and 72 guests