php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48872 string.c: errors: duplicate case values
Submitted: 2009-07-09 15:32 UTC Modified: 2009-07-27 07:14 UTC
From: nospam at hjcms dot de Assigned: kalle (profile)
Status: Closed Package: Compile Failure
PHP Version: 5.3.0 OS: Linux
Private report: No CVE-ID: None
 [2009-07-09 15:32 UTC] nospam at hjcms dot de
Description:
------------
-c /usr/src/packages/BUILD/php-5.3.0/ext/standard/string.c -o 
ext/standard/string.lo
/usr/src/packages/BUILD/php-5.3.0/ext/standard/string.c: In 
function 'zif_nl_langinfo':
/usr/src/packages/BUILD/php-5.3.0/ext/standard/string.c:592: error: 
duplicate case value
/usr/src/packages/BUILD/php-5.3.0/ext/standard/string.c:589: error: 
previously used here
/usr/src/packages/BUILD/php-5.3.0/ext/standard/string.c:598: error: 
duplicate case value
/usr/src/packages/BUILD/php-5.3.0/ext/standard/string.c:595: error: 
previously used here
gmake: *** [ext/standard/string.lo] Fehler 1

Reproduce code:
---------------
#ifdef DECIMAL_POINT
		case DECIMAL_POINT:
#endif
#ifdef RADIXCHAR
		case RADIXCHAR:
#endif
#ifdef THOUSANDS_SEP
		case THOUSANDS_SEP:
#endif
#ifdef THOUSEP
		case THOUSEP:
#endif


Expected result:
----------------
case mismatch with glibc 2.10.1
rpm -qf /usr/include/langinfo.h
glibc-devel-2.10.1-2009154

Actual result:
--------------
grep --color=auto -e DECIMAL_POINT -e RADIXCHAR -e THOUSANDS_SEP -e 
THOUSEP /usr/include/langinfo.h
  __MON_DECIMAL_POINT,
# define MON_DECIMAL_POINT      __MON_DECIMAL_POINT
  __MON_THOUSANDS_SEP,
# define MON_THOUSANDS_SEP      __MON_THOUSANDS_SEP
  _NL_MONETARY_DECIMAL_POINT_WC,
  _NL_MONETARY_THOUSANDS_SEP_WC,
  __DECIMAL_POINT = _NL_ITEM (__LC_NUMERIC, 0),
# define DECIMAL_POINT          __DECIMAL_POINT
  RADIXCHAR = __DECIMAL_POINT,
#define RADIXCHAR               RADIXCHAR
  __THOUSANDS_SEP,
# define THOUSANDS_SEP          __THOUSANDS_SEP
  THOUSEP = __THOUSANDS_SEP,
#define THOUSEP                 THOUSEP
  _NL_NUMERIC_DECIMAL_POINT_WC,
  _NL_NUMERIC_THOUSANDS_SEP_WC,


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-10 18:45 UTC] jani@php.net
From http://www.gnu.org/s/libc/manual/html_node/The-Elegant-and-Fast-
Way.html:
"
DECIMAL_POINT
RADIXCHAR
The same as the value returned by localeconv in the decimal_point 
element of the struct lconv.
The name RADIXCHAR is a deprecated alias still used in Unix98. 

THOUSANDS_SEP
THOUSEP
The same as the value returned by localeconv in the thousands_sep 
element of the struct lconv.
The name THOUSEP is a deprecated alias still used in Unix98. 
"

For some reason these aren't handled with #ifdef's in the code..
 [2009-07-17 23:53 UTC] kalle@php.net
I guess something in the way of this should do:

Index: string.c
===================================================================
--- string.c	(revision 284196)
+++ string.c	(working copy)
@@ -587,14 +587,12 @@
 #endif
 #ifdef DECIMAL_POINT
 		case DECIMAL_POINT:
-#endif
-#ifdef RADIXCHAR
+#elif defined(RADIXCHAR)
 		case RADIXCHAR:
 #endif
 #ifdef THOUSANDS_SEP
 		case THOUSANDS_SEP:
-#endif
-#ifdef THOUSEP
+#elif defined(THOUSEP)
 		case THOUSEP:
 #endif
 #ifdef GROUPING
 [2009-07-22 20:22 UTC] jani@php.net
Kalle, why don't you just commit that? Those macros are duplicates 
anyway and deprecated, IIRC. Shouldn't break anything.
 [2009-07-27 07:14 UTC] svn@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=286386
Log: Fixed bug #48872 (string.c: errors: duplicate case values) (Only in PHP_5_3)
 [2009-07-27 07:14 UTC] kalle@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC