General

Why we don’t using closing PHP tags…

by C.R. Matín on May 6, 2011

As a sign to all of the followers of the Sugar Developer Blog that we don’t just ignore the comments made to posts, I thought I would pull out a comment from my previous blog post to comment on. Here it is:

Hi John,
thanks for all. Can i ask something ? Why you don’t close de php tag ?
Is there any tip who can help for when use a close tag and where not ?

This is a pretty valid question, and probably one that is a bit confusing for those new to PHP. Let me explain…

As many of you know, PHP roots come from it being a language that was designed to be embedded within HTML markup, thus the need for tags in the first place to surround the PHP code that may be embedded within an HTML script. Nowadays, most PHP code written is kept separated from the presentation HTML markup, so files don’t necessarily need to jump back and forth between PHP and HTML. For these PHP only files you still do need an opening tag at the very beginning of the file, but you don’t need a closing tag since the EOF character is an implicit one effectively. Doing so has other benefits other than just saving a few extra characters, as pointed out in the Zend Framework Programmer’s Reference Guide:

For files that contain only PHP code, the closing tag (“?>”) is never permitted. It is not required by PHP, and omitting it´ prevents the accidental injection of trailing white space into the response.

So leaving out the closing tag eliminates trailing whitespace, which can throw off AJAX responses and various other scripts in the application. You do of course need the closing tag whenever you are mixing HTML and PHP code still, but otherwise it’s generally considered best practice to leave it out, and we try to follow this practice in SugarCRM.

{ 0 comments }

Sugar 6.1.2 is out!

by C.R. Matín on February 11, 2011

Fresh off the presses is the latest maintenance release for Sugar 6.1, version 6.1.2. Read more about the changes in the release notes, and grab the latest version for your platform.

For Sugar Engineering this is quite a landmark release, as it marks the beginning of our shorter release cycles for maintenance releases. Our goal is to get out a maintenance release for the latest major version of the application every 4 weeks. This will get the fixes to the issues that you our customers, partners, and community members are seeing in the product in your hands faster, in the process helping us build a more stable and more robust product.

And as always, if you are finding bugs in the product you would like to see address, please submit it to our bug portal so we can address it in a future release.

{ 0 comments }