php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61193 PHP_EOL definition for Mac OS X is wrong and unused
Submitted: 2012-02-27 11:47 UTC Modified: 2012-02-27 12:16 UTC
From: sam at robots dot org dot uk Assigned: rasmus (profile)
Status: Closed Package: *General Issues
PHP Version: 5.4.0RC8 OS:
Private report: No CVE-ID: None
 [2012-02-27 11:47 UTC] sam at robots dot org dot uk
Description:
------------
php.h contains:

#ifdef PHP_WIN32
#	include "tsrm_win32.h"
#	include "win95nt.h"
#	ifdef PHP_EXPORTS
#		define PHPAPI __declspec(dllexport)
#	else
#		define PHPAPI __declspec(dllimport)
#	endif
#	define PHP_DIR_SEPARATOR '\\'
#	define PHP_EOL "\r\n"
#else
#	if defined(__GNUC__) && __GNUC__ >= 4
#		define PHPAPI __attribute__ ((visibility("default")))
#	else
#		define PHPAPI
#	endif

#define THREAD_LS
#define PHP_DIR_SEPARATOR '/'
#if defined(__MacOSX__)
#define PHP_EOL "\r"
#else 
#define PHP_EOL "\n"
#endif
#endif

The indentation is bad, the value of PHP_EOL on Mac OS X is wrong, and the code 
never gets into the line that defines it incorrectly because there is no such 
macro as __MacOSX__. Instead you should test for __APPLE__ & __MACH__, in 
general, but in this case you should just remove the whole test for __MacOSX__ 
because it's not needed.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-27 12:16 UTC] rasmus@php.net
Automatic comment from SVN on behalf of rasmus
Revision: http://svn.php.net/viewvc/?view=revision&revision=323577
Log: Fix bug 61193
 [2012-02-27 12:16 UTC] rasmus@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: rasmus
 [2012-02-27 12:16 UTC] rasmus@php.net
Not sure how it can be both unused and wrong. It gets set to "\n" because 
__MacOSX__ doesn't exist. I agree the intent of the code is wrong now, but the 
end result is correct. I have cleaned it up.
 [2012-03-01 22:34 UTC] rasmus@php.net
Automatic comment from SVN on behalf of rasmus
Revision: http://svn.php.net/viewvc/?view=revision&revision=323737
Log: Merge fix for bug 61193
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 22:01:30 2024 UTC