Post by supak111 » Sun Jan 10, 2021 4:39 am

Can anyone help me with this error on OC 3.0.3.2:

Code: Select all

2021-01-09 3:11:28 - PHP Warning:  fread(): Length parameter must be greater than 0 in /home/xxx/public_html/system/library/session/file.php on line 14
Here is the file.php:

Code: Select all

	public function read($session_id) {
		$file = DIR_SESSION . '/sess_' . basename($session_id);

		if (is_file($file)) {
			$handle = fopen($file, 'r');

			flock($handle, LOCK_SH);

			$data = fread($handle, filesize($file));

			flock($handle, LOCK_UN);

			fclose($handle);

			return unserialize($data);
		} else {
			return array();
		}
	}
Line 14 is :

Code: Select all

$data = fread($handle, filesize($file));

~ OC 3.0.3.2 and OCmods only ~


User avatar
Active Member

Posts

Joined
Fri Feb 13, 2015 12:09 pm

Post by straightlight » Sun Jan 10, 2021 9:43 am

Permission issues. Ensure your CHMOD settings are properly configured on your folders (recursively). Also ensure your storage folder is located outside of your public_html folder and both config.php files configured accordingly.

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 supak111 » Sun Jan 10, 2021 2:21 pm

Straightlight thanks for the reply :)

Didn't change anything on my website recently and its the first time seeing this error, happened 4 times to one visitor... Wonder if its going to continue happening now. And yes my storage has been outside of public_html.

Any other reason this error could happen?

~ OC 3.0.3.2 and OCmods only ~


User avatar
Active Member

Posts

Joined
Fri Feb 13, 2015 12:09 pm

Post by ADD Creative » Sun Jan 10, 2021 9:11 pm

The size of the session file must be zero. It looks like there has been a change on the master branch to account for this.

https://github.com/opencart/opencart/co ... f7a088d072

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by straightlight » Sun Jan 10, 2021 10:53 pm

I am not entirely sure about all these changes regarding the cache but this one should do from the master branch: upload/system/library/session/file.php .

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 paulfeakins » Mon Jan 11, 2021 7:33 pm

supak111 wrote:
Sun Jan 10, 2021 2:21 pm
Any other reason this error could happen?
Hosts changing stuff.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: nonnedelectari and 407 guests