Some of my PHP files are missing the ?> at the end of the file

In Zen Cart, some of my PHP files are missing the ?> at the end of the file

Symptom

The ending ?> seems to be missing in some of my files.

With a Diff viewer I can see that in some cases the last line has changed from ?> to //EOF.

Cause

This is completely acceptable and has been done intentionally.

As you may know, if you try to run a PHP file which has whitespace (spaces or blank lines etc) after the final ?> then it can cause problems, usually the dreaded headers already sent error.

Removing the ?> from php files is a way of mitigating against this error. PHP will quite happily work without it (automatically assuming the closing tag at the end of the file), and thus any whitespace at the end of the file will not cause errors.

More information can be found on this PHP.net page.

Solution

There is no special action to be taken. This is an ongoing process that will continue into future versions of Zen Cart.




Still have questions? No problem! Just head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.



Last modified March 23, 2020 by Scott C Wilson (7eff069).