Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: Check for military time Date: Fri, 30 Oct 2015 20:08:26 +0100 Lines: 97 Message-ID: <5633C02A.60502@arnowelzel.de> References: <1874827.QbCUPLQBcH@PointedEars.de> <562F77B7.1050001@arnowelzel.de> <8737wvd78w.fsf@ahungry.com> <5631e20e$0$23743$e4fe514c@news.xs4all.nl> <87y4elb05f.fsf@ahungry.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: individual.net dV2yb7XVvUC79c7OL2PK8wtlM1a4RUEdhZM/TWxN6e0oMMoZyA Cancel-Lock: sha1:ZJeqohWw1WhUXHOD+JLOXQbMVPM= In-Reply-To: Xref: csiph.com comp.lang.php:15814 Jerry Stuckle schrieb am 2015-10-30 um 03:35: > On 10/29/2015 9:44 PM, Matthew Carter wrote: >> Erwin Moller writes: >> >>> On 10/28/2015 4:29 AM, Jerry Stuckle wrote: >>>> >>>> YOU don't see any problem. Good programmers do. >>>> >>>> Just wait until you run into a problem because of it. Your tune will >>>> change. And I'm not the only one who feels this way. >>>> >>> >>> Seconded. >>> Always use the closing tag. >>> >>> >>> If you get into trouble because you produce output after the closing >>> tag, get another job. >>> If that is over your head, you should change jobs, not the programming >>> language (or usage of it). >>> It isn't that hard. >>> This advice from php.net is ridiculous. >>> >>> This reminds me a lot of the curly bracket in conditional statements. >>> Some seem to think omitting them is alright for single statements. >>> It is, of course, not alright to omit them. >>> >>> >>> Regards, >>> Erwin Moller >> >> Other than a feeling of self righteousness, what is gained again? >> >> Tell me, in these two sample files, which is easier to debug if the >> aforementioned use cases occurred that cause an error when the file is >> included by another file making use of header responses: >> >> ------------------File One (no closing tag, misplaced HTML)----------- >> > >> function add($a, $b) { >> return $a + $b; >> } >> >>

This is my great page of addition!

>> >> ------------------File Two (closing tag, extra space)----------------- >> > >> function add($a, $b) { >> return $a + $b; >> } >> >> ?> >> >> >> Assuming both were included/required in another file, which one would >> the majority of programmers have an easier time pinpointing the error >> with? (hint: the one where the PHP error reporting would tell you >> exactly where the faulty HTML was originating, NOT the file that was >> outputting some whitespace before a header call - that error would send >> you to the header() call line, not the bad file with trailing space). >> >> There have been 0 good reasons for including a closing tag (it's just too >> bad we can't actually have a '.phpdef' file type or something that >> simulates a 100% PHP only file, without dropping in and out of tags and >> just avoids the use of the nonsense entirely). >> > > Proper coding techniques and it wouldn't happen in the first place. > > But to answer your question - the problem is your test can cause a fatal > error, potentially displaying internal information to a user. This > information could be used to hack the system. Therefore one 1) will TEST stuff BEFORE it goes to the production system 2) configures the production system in a way that it will NEVER display ANY error to the user Do you really want to tell us you don't know that? > But I know you will dismiss any reason given, so go ahead and make a > fool of yourself. You've obviously never worked on a multi-programmer > project with coding conventions. And you seem to never have worked on real production systems. And yes - omitting closing tags *can* be a coding convention within the team as well. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de