Forums / General Questions / PHP Warning: fread() : Length parameter must be greater than 0 ...

PHP Warning: fread() : Length parameter must be greater than 0 ...

Views: 4,437

Results 1 to 8 of 8
23 Oct 2013, 7:52 PM
#1
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

PHP Warning: fread() : Length parameter must be greater than 0 ...

I am getting the following error in the debug logs everytime an order is placed:

[23-Oct-2013 11:51:38] PHP Warning: fread() [<a href='function.fread'>function.fread</a>]: Length parameter must be greater than 0 in /home3/***/public_html/shop/includes/functions/functions_email.php on line 414

This is line 414:

$file_holder = fread($fh, filesize($template_filename));

I have searched the forums, but have been unable to find a solution. Can anyone help me understand how to fix this error?

Thanks!

Danielle

23 Oct 2013, 8:53 PM
#2
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Re: PHP Warning: fread() : Length parameter must be greater than 0 ...

Which ZC version are you using?

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

23 Oct 2013, 10:35 PM
#3
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: PHP Warning: fread() : Length parameter must be greater than 0 ...

Version 1.3.8a

Danielle

25 Oct 2013, 5:00 PM
#4
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: PHP Warning: fread() : Length parameter must be greater than 0 ...

We are also getting this error at checkout, which I would assume is related:

Email error: Could not instantiate mail function. Please check Admin->Configuration->Email Options->Email Transport.

I have checked those settings, and they are correct. We are able to send and receive e-mails, and the Email Archive Manager confirms that e-mails are going through. I'm not sure what else to do to fix these problems?

Danielle

25 Oct 2013, 5:53 PM
#5
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: PHP Warning: fread() : Length parameter must be greater than 0 ...

Actually, weirdly, they were unrelated issues. We have resolved the Email Error, but are still getting the error in the debug log about the length parameter.

Danielle:

We are also getting this error at checkout, which I would assume is related:

Email error: Could not instantiate mail function. Please check Admin->Configuration->Email Options->Email Transport.

I have checked those settings, and they are correct. We are able to send and receive e-mails, and the Email Archive Manager confirms that e-mails are going through. I'm not sure what else to do to fix these problems?

Danielle

25 Oct 2013, 7:34 PM
#6
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: PHP Warning: fread() : Length parameter must be greater than 0 ...

Danielle:

I am getting the following error in the debug logs everytime an order is placed:

[23-Oct-2013 11:51:38] PHP Warning: fread() [<a href='function.fread'>function.fread</a>]: Length parameter must be greater than 0 in /home3/***/public_html/shop/includes/functions/functions_email.php on line 414

This is line 414:

$file_holder = fread($fh, filesize($template_filename));

I have searched the forums, but have been unable to find a solution. Can anyone help me understand how to fix this error?

Thanks!

Danielle:

Version 1.3.8a

You DO need to upgrade, to another version of zen cart. You should upgrade to V1.3.9h (minimum) or preferably, V1.5.1.. There are several known vulnerabilities with Zen V1.3.8(a) that are being actively exploited. The zen cart you are running is well out of date and full of security vulnerability and not supported any longer. You should really invest in the time to bring you zen cart version up to date.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

25 Oct 2013, 8:16 PM
#7
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: PHP Warning: fread() : Length parameter must be greater than 0 ...

Yes I know. Unfortunately the client does not want to upgrade at this time.

countrycharm:

You DO need to upgrade, to another version of zen cart. You should upgrade to V1.3.9h (minimum) or preferably, V1.5.1.. There are several known vulnerabilities with Zen V1.3.8(a) that are being actively exploited. The zen cart you are running is well out of date and full of security vulnerability and not supported any longer. You should really invest in the time to bring you zen cart version up to date.

Danielle

26 Oct 2013, 12:23 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: PHP Warning: fread() : Length parameter must be greater than 0 ...

If filesize($template_filename) is returning a 0 or null, then chances are your server's filesystem is refusing to return filesize data about the files when PHP asks for it.
Contact the server administrator for assistance.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.