News for hackers. Stuff that matters.
Re:Five reasons why the PHP silence operator @ should be avo... by TazeTSchnitzel on Thursday January 10, 2013 @01:14PM (#5038619)
Oh, it's just one of thousands of nonsensical PHP features.

Like the fact that the language's grammar is used to do primitive type checking, meaning some combinations of accessors cause errors.

Or the fact the mail sending function doesn't work if one of the lines in the email begins with a period, but only if you're on Windows.

Re:Five reasons why the PHP silence operator @ should be avo... by acabal on Thursday January 10, 2013 @03:05PM (#5039406)
Some of the weirder OS-specific function behaviors can be a rationalized a little better if you view PHP functions not as sane, complete library functions, but rather as thin wrappers to the underlying OS. For mail() it basically just wraps the system's mail program in Linux (which comes with a huge number of dangerous gotchas for the uninitiated) and I imagine in Windows it wraps the local mail program which seems to have a gotcha with periods. I think a lot of the file management functions are the same.

That's one of the many problems with PHP's underlying design philosopy: instead of providing a higher-level interface that stays consistent across platforms, it exposes low-level OS gunk and gotchas through its thin wrappers on low-level-ish functions. I put together phpbestpractices.org a few months ago in an attempt to document some of those common gotchas and provide sane alternatives.

Re:Five reasons why the PHP silence operator @ should be avo... by TazeTSchnitzel on Thursday January 10, 2013 @03:09PM (#5039425)
>PHP functions not as sane, complete library functions, but rather as thin wrappers to the underlying OS.

Except they're not really that thin.

>in Windows it wraps the local mail program which seems to have a gotcha with periods

Nope, in Windows it implements the SMTP protocol, on UNIX it runs sendmail.

>instead of providing a higher-level interface that stays consistent across platforms, it exposes low-level OS gunk and gotchas through its thin wrappers on low-level-ish functions.

Except it doesn't. There's quite a few things that are named like OS functions, but are implemented internally. For example, all the C stdlib-like string functions.

Re:Five reasons why the PHP silence operator @ should be avo... by acabal on Thursday January 10, 2013 @03:14PM (#5039448)
My mistake then :) I admit I haven't read the source, I'm just going off of the quirkiness of cross-platform PHP and the way the functions seem to behave.