Quantcast

Zend Mail and Postfix < 2.9

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Zend Mail and Postfix < 2.9

Stewart Lord
Hi Folks,

It looks like Zend\Mail with the default sendmail transport has a
problem with most versions of Postfix. "CRLF" line endings become
"CRCRLF" on postfix < 2.9 (2.9 was released Feb. 1, 2012). This causes
headers to spill out into the message. The fix is to use LF.

We need the ability to vary the EOL by transport. Currently it is a
constant in Headers. When talking to SMTP, CRLF is the correct line
ending to use, but when talking to sendmail it would appear that PHP_EOL
is actually the correct line-ending to use (despite what the docs say).
This is discussed in an ancient bug report here:

https://bugs.php.net/bug.php?id=15841

The gist of it is:

"mail() talks to the sendmail command on Unix/Linux which
expects line endings to be the platform's native line endings
which is LF (\n) only on Unix/Linux and CRLF (\r\n) on Windows.
The sendmail will replace LF (\n) by CRLF (\r\n) automatically
to comply with RFC 2822. Thus you should use the special PHP_EOL
constant to separate mail headers."

Stew
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Wesley Overdijk
Hi Stew,

Because line endings should be CRLF, I think the bug is simply the face that it replaces \n with \r\n, obviously duplicating any line ending that already was \r\n. I don't think that using LF is a "fix" to be honest, because you will then mess up other systems.

Wesley Overdijk

On 02 Feb 2013, at 09:13, Stewart Lord <[hidden email]> wrote:

> Hi Folks,
>
> It looks like Zend\Mail with the default sendmail transport has a problem with most versions of Postfix. "CRLF" line endings become "CRCRLF" on postfix < 2.9 (2.9 was released Feb. 1, 2012). This causes headers to spill out into the message. The fix is to use LF.
>
> We need the ability to vary the EOL by transport. Currently it is a constant in Headers. When talking to SMTP, CRLF is the correct line ending to use, but when talking to sendmail it would appear that PHP_EOL is actually the correct line-ending to use (despite what the docs say). This is discussed in an ancient bug report here:
>
> https://bugs.php.net/bug.php?id=15841
>
> The gist of it is:
>
> "mail() talks to the sendmail command on Unix/Linux which
> expects line endings to be the platform's native line endings
> which is LF (\n) only on Unix/Linux and CRLF (\r\n) on Windows.
> The sendmail will replace LF (\n) by CRLF (\r\n) automatically
> to comply with RFC 2822. Thus you should use the special PHP_EOL
> constant to separate mail headers."
>
> Stew

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Stewart Lord
That's the point, they shouldn't be CRLF. Having read the bug report, the php source for mail() and researched the flag in postfix 2.9 (qmail had the same issue btw), I don't think it should be CRLF except when talking SMTP. Despite what the manual says, php uses LF for the headers that it composes for sendmail:



On 2013-02-02, at 9:34 AM, Wesley Overdijk <[hidden email]> wrote:

Hi Stew,

Because line endings should be CRLF, I think the bug is simply the face that it replaces \n with \r\n, obviously duplicating any line ending that already was \r\n. I don't think that using LF is a "fix" to be honest, because you will then mess up other systems.

Wesley Overdijk

On 02 Feb 2013, at 09:13, Stewart Lord <[hidden email]> wrote:

Hi Folks,

It looks like Zend\Mail with the default sendmail transport has a problem with most versions of Postfix. "CRLF" line endings become "CRCRLF" on postfix < 2.9 (2.9 was released Feb. 1, 2012). This causes headers to spill out into the message. The fix is to use LF.

We need the ability to vary the EOL by transport. Currently it is a constant in Headers. When talking to SMTP, CRLF is the correct line ending to use, but when talking to sendmail it would appear that PHP_EOL is actually the correct line-ending to use (despite what the docs say). This is discussed in an ancient bug report here:

https://bugs.php.net/bug.php?id=15841

The gist of it is:

"mail() talks to the sendmail command on Unix/Linux which
expects line endings to be the platform's native line endings
which is LF (\n) only on Unix/Linux and CRLF (\r\n) on Windows.
The sendmail will replace LF (\n) by CRLF (\r\n) automatically
to comply with RFC 2822. Thus you should use the special PHP_EOL
constant to separate mail headers."

Stew

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Wesley Overdijk
Hm you're right. I think we should be using PHP_EOL.

On 02 Feb 2013, at 19:11, Stewart Lord <[hidden email]> wrote:

That's the point, they shouldn't be CRLF. Having read the bug report, the php source for mail() and researched the flag in postfix 2.9 (qmail had the same issue btw), I don't think it should be CRLF except when talking SMTP. Despite what the manual says, php uses LF for the headers that it composes for sendmail:



On 2013-02-02, at 9:34 AM, Wesley Overdijk <[hidden email]> wrote:

Hi Stew,

Because line endings should be CRLF, I think the bug is simply the face that it replaces \n with \r\n, obviously duplicating any line ending that already was \r\n. I don't think that using LF is a "fix" to be honest, because you will then mess up other systems.

Wesley Overdijk

On 02 Feb 2013, at 09:13, Stewart Lord <[hidden email]> wrote:

Hi Folks,

It looks like Zend\Mail with the default sendmail transport has a problem with most versions of Postfix. "CRLF" line endings become "CRCRLF" on postfix < 2.9 (2.9 was released Feb. 1, 2012). This causes headers to spill out into the message. The fix is to use LF.

We need the ability to vary the EOL by transport. Currently it is a constant in Headers. When talking to SMTP, CRLF is the correct line ending to use, but when talking to sendmail it would appear that PHP_EOL is actually the correct line-ending to use (despite what the docs say). This is discussed in an ancient bug report here:

https://bugs.php.net/bug.php?id=15841

The gist of it is:

"mail() talks to the sendmail command on Unix/Linux which
expects line endings to be the platform's native line endings
which is LF (\n) only on Unix/Linux and CRLF (\r\n) on Windows.
The sendmail will replace LF (\n) by CRLF (\r\n) automatically
to comply with RFC 2822. Thus you should use the special PHP_EOL
constant to separate mail headers."

Stew


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Luis "Kindaian"
Hi List,

From the manual:

PHP_EOL (string)
The correct 'End Of Line' symbol for this platform. Available since PHP 4.3.10 and PHP 5.0.2


Which if i interpret correctly, means that it varies from which platform the code is used. And on windows version of PHP you will get the same CRLF which will result on the same error (not to mention that on Mac, probably it will result on other mail servers to break, but that is just my assumption).

In this case, i think some extra care need to be done and probably stick with just using LF on all platforms (and perhaps check what the email RFCs require).

Cheers,
Luis Ferro

On 2013/02/02 20:12, Wesley Overdijk wrote:
Hm you're right. I think we should be using PHP_EOL.

On 02 Feb 2013, at 19:11, Stewart Lord <[hidden email]> wrote:

That's the point, they shouldn't be CRLF. Having read the bug report, the php source for mail() and researched the flag in postfix 2.9 (qmail had the same issue btw), I don't think it should be CRLF except when talking SMTP. Despite what the manual says, php uses LF for the headers that it composes for sendmail:



On 2013-02-02, at 9:34 AM, Wesley Overdijk <[hidden email]> wrote:

Hi Stew,

Because line endings should be CRLF, I think the bug is simply the face that it replaces \n with \r\n, obviously duplicating any line ending that already was \r\n. I don't think that using LF is a "fix" to be honest, because you will then mess up other systems.

Wesley Overdijk

On 02 Feb 2013, at 09:13, Stewart Lord <[hidden email]> wrote:

Hi Folks,

It looks like Zend\Mail with the default sendmail transport has a problem with most versions of Postfix. "CRLF" line endings become "CRCRLF" on postfix < 2.9 (2.9 was released Feb. 1, 2012). This causes headers to spill out into the message. The fix is to use LF.

We need the ability to vary the EOL by transport. Currently it is a constant in Headers. When talking to SMTP, CRLF is the correct line ending to use, but when talking to sendmail it would appear that PHP_EOL is actually the correct line-ending to use (despite what the docs say). This is discussed in an ancient bug report here:

https://bugs.php.net/bug.php?id=15841

The gist of it is:

"mail() talks to the sendmail command on Unix/Linux which
expects line endings to be the platform's native line endings
which is LF (\n) only on Unix/Linux and CRLF (\r\n) on Windows.
The sendmail will replace LF (\n) by CRLF (\r\n) automatically
to comply with RFC 2822. Thus you should use the special PHP_EOL
constant to separate mail headers."

Stew



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Xerkus
Email RFC require strictly CRLF. We are talking platform implementation quirks here.

On 03.02.2013 20:20, Luis Ferro wrote:
Hi List,

From the manual:

PHP_EOL (string)
The correct 'End Of Line' symbol for this platform. Available since PHP 4.3.10 and PHP 5.0.2


Which if i interpret correctly, means that it varies from which platform the code is used. And on windows version of PHP you will get the same CRLF which will result on the same error (not to mention that on Mac, probably it will result on other mail servers to break, but that is just my assumption).

In this case, i think some extra care need to be done and probably stick with just using LF on all platforms (and perhaps check what the email RFCs require).

Cheers,
Luis Ferro



-- 
Aleksey Khudyakov
Web developer, ZCE
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Stewart Lord
Things are quirky indeed. PHP's mail() function uses SMTP on Windows
(not sendmail), so CRLF is what we want.


On 2/3/13 1:24 AM, Aleksey Khudyakov wrote:

> Email RFC require strictly CRLF. We are talking platform implementation
> quirks here.
>
> On 03.02.2013 20:20, Luis Ferro wrote:
>> Hi List,
>>
>> From the manual:
>>
>> *|PHP_EOL|* (string
>> <http://www.php.net/manual/en/language.types.string.php>)
>>     The correct 'End Of Line' symbol for this platform. Available
>>     since PHP 4.3.10 and PHP 5.0.2
>>
>> Which if i interpret correctly, means that it varies from which
>> platform the code is used. And on windows version of PHP you will get
>> the same CRLF which will result on the same error (not to mention that
>> on Mac, probably it will result on other mail servers to break, but
>> that is just my assumption).
>>
>> In this case, i think some extra care need to be done and probably
>> stick with just using LF on all platforms (and perhaps check what the
>> email RFCs require).
>>
>> Cheers,
>> Luis Ferro
>>
>
>
> --
> Aleksey Khudyakov
> Web developer, ZCE
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Wesley Overdijk
So basically, we can not trust the platform to correctly set the EOL style.so for windows we should set CRLF, and for all other systems PHP_EOL. @Aleksey, yes. That's for smtp. Sendmail, however, should correctly convert the OS EOL style. I'm not sure how we should proceed with this.

On 03 Feb 2013, at 11:17, Stewart Lord <[hidden email]> wrote:

> Things are quirky indeed. PHP's mail() function uses SMTP on Windows (not sendmail), so CRLF is what we want.
>
>
> On 2/3/13 1:24 AM, Aleksey Khudyakov wrote:
>> Email RFC require strictly CRLF. We are talking platform implementation
>> quirks here.
>>
>> On 03.02.2013 20:20, Luis Ferro wrote:
>>> Hi List,
>>>
>>> From the manual:
>>>
>>> *|PHP_EOL|* (string
>>> <http://www.php.net/manual/en/language.types.string.php>)
>>>    The correct 'End Of Line' symbol for this platform. Available
>>>    since PHP 4.3.10 and PHP 5.0.2
>>>
>>> Which if i interpret correctly, means that it varies from which
>>> platform the code is used. And on windows version of PHP you will get
>>> the same CRLF which will result on the same error (not to mention that
>>> on Mac, probably it will result on other mail servers to break, but
>>> that is just my assumption).
>>>
>>> In this case, i think some extra care need to be done and probably
>>> stick with just using LF on all platforms (and perhaps check what the
>>> email RFCs require).
>>>
>>> Cheers,
>>> Luis Ferro
>>>
>>
>>
>> --
>> Aleksey Khudyakov
>> Web developer, ZCE
>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Stewart Lord
On 2/3/13 6:53 AM, Wesley Overdijk wrote:
> So basically, we can not trust the platform to correctly
> set the EOL style.so for windows we should set CRLF, and
> for all other systems PHP_EOL. @Aleksey, yes. That's for
> smtp. Sendmail, however, should correctly convert the OS
> EOL style. I'm not sure how we should proceed with this.


I think it's pretty clear. We need to switch to PHP_EOL for the sendmail
transport and keep CRLF for the SMTP transport.

Stew
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Wesley Overdijk
Right, but does windows still do this conversion step? (PHP_EOL to CRLF). If now, we'll need a conditional (if windows).

On 4 feb. 2013, at 09:41, Stewart Lord <[hidden email]> wrote:

> On 2/3/13 6:53 AM, Wesley Overdijk wrote:
>> So basically, we can not trust the platform to correctly
>> set the EOL style.so for windows we should set CRLF, and
>> for all other systems PHP_EOL. @Aleksey, yes. That's for
>> smtp. Sendmail, however, should correctly convert the OS
>> EOL style. I'm not sure how we should proceed with this.
>
>
> I think it's pretty clear. We need to switch to PHP_EOL for the sendmail transport and keep CRLF for the SMTP transport.
>
> Stew

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Artur Bodera
On Mon, Feb 4, 2013 at 9:47 AM, Wesley Overdijk <[hidden email]> wrote:
Right, but does windows still do this conversion step? (PHP_EOL to CRLF). If now, we'll need a conditional (if windows).

Ugh... bare LFs again (http://cr.yp.to/docs/smtplf.html)

We could use this to detect windows:


-- 
      __
     /.)\   <a href="tel:%2B48%20695%20600%20936" value="+48695600936" target="_blank">+48 695 600 936
     \(./   [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Wesley Overdijk
When using sendmail, you'd expect that using the PHP_EOL would make sense, or that the passed EOL format is untouched. In our case, we're fiddling with both. I'll look into it a bit more.. But if all prevails, I'm afraid we're stuck with OS specific implementations.

On 4 feb. 2013, at 10:21, Artur Bodera <[hidden email]> wrote:

On Mon, Feb 4, 2013 at 9:47 AM, Wesley Overdijk <[hidden email]> wrote:
Right, but does windows still do this conversion step? (PHP_EOL to CRLF). If now, we'll need a conditional (if windows).

Ugh... bare LFs again (http://cr.yp.to/docs/smtplf.html)

We could use this to detect windows:


-- 
      __
     /.)\   <a href="tel:%2B48%20695%20600%20936" value="+48695600936" target="_blank">+48 695 600 936
     \(./   [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Stewart Lord
In reply to this post by Wesley Overdijk
On 2013-02-04 12:47 AM, Wesley Overdijk wrote:
> Right, but does windows still do this conversion step? (PHP_EOL to CRLF). If now, we'll need a conditional (if windows).

PHP_EOL is LF on Unix and CRLF on Windows, so there is no conversion.

http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-php-eol
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Wesley Overdijk
*Note to self: No more sending emails when tired, and multitasking*

I guess that we've found our solution then.

On 04 Feb 2013, at 19:15, Stewart Lord <[hidden email]> wrote:

> On 2013-02-04 12:47 AM, Wesley Overdijk wrote:
>> Right, but does windows still do this conversion step? (PHP_EOL to CRLF). If now, we'll need a conditional (if windows).
>
> PHP_EOL is LF on Unix and CRLF on Windows, so there is no conversion.
>
> http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-php-eol

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Luis "Kindaian"
That is a nice issue raised on stackoverflow and on the bug report.

However, how can i agree with the solution implemented on PHP when it
breaks compatibility with one whole platform (as small as it is in terms
of global user base)?

Feel free to adopt the PHP_EOL in Zend Framework, however, i would shy
away from it due to that and another detail:

The system that it is being targeted is a mail server, which may or may
not be on the same platform.

Assuming that if one uses a "local" EOL and that it will work on the
remote "server" as it should is i would think a bit of a stretch.

But then, i may be failing to grasp the whole issue (which is just
natural at the moment).
LF (and that is not an EOL)


On 2013/02/04 18:23, Wesley Overdijk wrote:

> *Note to self: No more sending emails when tired, and multitasking*
>
> I guess that we've found our solution then.
>
> On 04 Feb 2013, at 19:15, Stewart Lord <[hidden email]> wrote:
>
>> On 2013-02-04 12:47 AM, Wesley Overdijk wrote:
>>> Right, but does windows still do this conversion step? (PHP_EOL to CRLF). If now, we'll need a conditional (if windows).
>> PHP_EOL is LF on Unix and CRLF on Windows, so there is no conversion.
>>
>> http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-php-eol

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Stewart Lord
 > However, how can i agree with the solution implemented on PHP when it
 > breaks compatibility with one whole platform (as small as it is in
 > terms of global user base)?

Hi Luis, it sounds like there is still some confusion. What platform
would it break compatibility with?

 > The system that it is being targeted is a mail server, which may or
 > may not be on the same platform.

To be clear, sendmail is local. SMTP is remote. Again, I am saying we
should use PHP_EOL for the sendmail/mail() transport and CRLF for SMTP.

Stew


On 2/4/13 4:28 PM, Luis Ferro wrote:

> That is a nice issue raised on stackoverflow and on the bug report.
>
> However, how can i agree with the solution implemented on PHP when it
> breaks compatibility with one whole platform (as small as it is in terms
> of global user base)?
>
> Feel free to adopt the PHP_EOL in Zend Framework, however, i would shy
> away from it due to that and another detail:
>
> The system that it is being targeted is a mail server, which may or may
> not be on the same platform.
>
> Assuming that if one uses a "local" EOL and that it will work on the
> remote "server" as it should is i would think a bit of a stretch.
>
> But then, i may be failing to grasp the whole issue (which is just
> natural at the moment).
> LF (and that is not an EOL)
>
>
> On 2013/02/04 18:23, Wesley Overdijk wrote:
>> *Note to self: No more sending emails when tired, and multitasking*
>>
>> I guess that we've found our solution then.
>>
>> On 04 Feb 2013, at 19:15, Stewart Lord <[hidden email]> wrote:
>>
>>> On 2013-02-04 12:47 AM, Wesley Overdijk wrote:
>>>> Right, but does windows still do this conversion step? (PHP_EOL to
>>>> CRLF). If now, we'll need a conditional (if windows).
>>> PHP_EOL is LF on Unix and CRLF on Windows, so there is no conversion.
>>>
>>> http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-php-eol
>>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Wesley Overdijk

On 5 feb. 2013, at 05:04, Stewart Lord <[hidden email]> wrote:

> > However, how can i agree with the solution implemented on PHP when it
> > breaks compatibility with one whole platform (as small as it is in
> > terms of global user base)?
>
> Hi Luis, it sounds like there is still some confusion. What platform would it break compatibility with?
I'm curious, too. It would only break systems where they've implemented a workaround to resolve this issue. I don't see a problem there, as long as we address this in the release it belongs to.
>
> > The system that it is being targeted is a mail server, which may or
> > may not be on the same platform.
>
> To be clear, sendmail is local. SMTP is remote. Again, I am saying we should use PHP_EOL for the sendmail/mail() transport and CRLF for SMTP.
You beat me to it.

>
> Stew
>
>
> On 2/4/13 4:28 PM, Luis Ferro wrote:
>> That is a nice issue raised on stackoverflow and on the bug report.
>>
>> However, how can i agree with the solution implemented on PHP when it
>> breaks compatibility with one whole platform (as small as it is in terms
>> of global user base)?
>>
>> Feel free to adopt the PHP_EOL in Zend Framework, however, i would shy
>> away from it due to that and another detail:
>>
>> The system that it is being targeted is a mail server, which may or may
>> not be on the same platform.
>>
>> Assuming that if one uses a "local" EOL and that it will work on the
>> remote "server" as it should is i would think a bit of a stretch.
>>
>> But then, i may be failing to grasp the whole issue (which is just
>> natural at the moment).
>> LF (and that is not an EOL)
>>
>>
>> On 2013/02/04 18:23, Wesley Overdijk wrote:
>>> *Note to self: No more sending emails when tired, and multitasking*
>>>
>>> I guess that we've found our solution then.
>>>
>>> On 04 Feb 2013, at 19:15, Stewart Lord <[hidden email]> wrote:
>>>
>>>> On 2013-02-04 12:47 AM, Wesley Overdijk wrote:
>>>>> Right, but does windows still do this conversion step? (PHP_EOL to
>>>>> CRLF). If now, we'll need a conditional (if windows).
>>>> PHP_EOL is LF on Unix and CRLF on Windows, so there is no conversion.
>>>>
>>>> http://stackoverflow.com/questions/128560/when-do-i-use-the-php-constant-php-eol
>>>>
>>
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Marian Meres-2
In reply to this post by Artur Bodera
Hello Guys,

On Mon, Feb 4, 2013 at 10:21 AM, Artur Bodera <[hidden email]> wrote:
> We could use this to detect windows:
> https://github.com/zendframework/zf2/blob/master/library/Zend/Console/Console.php#L110

sorry to go off-topic a little bit here, but I have always used something like:

if ("\\" == DIRECTORY_SEPARATOR) {
    // is windows
}

so I'm curious whether I should start using the (longer and less
readable) zend console example above... Any ideas why the dir
separator should not work?

Thank you very much.

Regards,
Marian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Wesley Overdijk
It's highly unlikely that the directory separator is ever going to change. However, in theory, it can. That's why you shouldn't use it imo.

On 5 feb. 2013, at 09:59, Marian Meres <[hidden email]> wrote:

> Hello Guys,
>
> On Mon, Feb 4, 2013 at 10:21 AM, Artur Bodera <[hidden email]> wrote:
>> We could use this to detect windows:
>> https://github.com/zendframework/zf2/blob/master/library/Zend/Console/Console.php#L110
>
> sorry to go off-topic a little bit here, but I have always used something like:
>
> if ("\\" == DIRECTORY_SEPARATOR) {
>    // is windows
> }
>
> so I'm curious whether I should start using the (longer and less
> readable) zend console example above... Any ideas why the dir
> separator should not work?
>
> Thank you very much.
>
> Regards,
> Marian

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Zend Mail and Postfix < 2.9

Artur Bodera
In reply to this post by Marian Meres-2
On Tue, Feb 5, 2013 at 9:59 AM, Marian Meres <[hidden email]> wrote:
Hello Guys,

On Mon, Feb 4, 2013 at 10:21 AM, Artur Bodera <[hidden email]> wrote:
> We could use this to detect windows:
> https://github.com/zendframework/zf2/blob/master/library/Zend/Console/Console.php#L110

sorry to go off-topic a little bit here, but I have always used something like:
if ("\\" == DIRECTORY_SEPARATOR) {
    // is windows
}

so I'm curious whether I should start using the (longer and less
readable) zend console example above... Any ideas why the dir
separator should not work?

I've linked an url to a discussion on SO about that (under @see annotation in that method).

One possible case might be a more posix-compliant Microsoft OS in the future (Server 2020 :), which might change directory separators but still have a legacy win32 api.  Powershell, pipes and other CLI enhancements in latest Win Server products suggest they're heading this way...

-- 
      __
     /.)\   +48 695 600 936
     \(./   [hidden email]

 
12
Loading...