tony2001                Thu Aug 24 11:05:38 2006 UTC

  Modified files:              
    /php-src/ext/standard       config.m4 datetime.c 
  Log:
  this fixes segfault in strptime() on 64bit Linuxes, caused by the missing 
declaration
  unfortunately defining _XOPEN_SOURCE breaks the build (some odd dependencies 
in glibc headers) and this seems to be the best solution
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/config.m4?r1=1.83&r2=1.84&diff_format=u
Index: php-src/ext/standard/config.m4
diff -u php-src/ext/standard/config.m4:1.83 php-src/ext/standard/config.m4:1.84
--- php-src/ext/standard/config.m4:1.83 Wed Jan  4 12:57:04 2006
+++ php-src/ext/standard/config.m4      Thu Aug 24 11:05:38 2006
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.83 2006/01/04 12:57:04 derick Exp $ -*- autoconf -*-
+dnl $Id: config.m4,v 1.84 2006/08/24 11:05:38 tony2001 Exp $ -*- autoconf -*-
 
 divert(3)dnl
 
@@ -477,6 +477,26 @@
   AC_DEFINE([HAVE_HUGE_VAL_NAN], 1, [whether HUGE_VAL + -HUGEVAL == NAN])
 fi
 
+AC_CACHE_CHECK(whether strptime() declaration fails, 
ac_cv_strptime_decl_fails,[
+  AC_TRY_COMPILE([
+#include <time.h>
+  ],[
+#ifndef HAVE_STRPTIME
+#error no strptime() on this platform
+#else
+/* use invalid strptime() declaration to see if it fails to compile */
+int strptime(const char *s, const char *format, struct tm *tm);
+#endif
+  ],[
+      ac_cv_strptime_decl_fails=no
+  ],[
+      ac_cv_strptime_decl_fails=yes
+  ])
+])
+if test "$ac_cv_strptime_decl_fails" = "yes"; then
+  AC_DEFINE([HAVE_STRPTIME_DECL_FAILS], 1, [whether strptime() declaration 
fails])
+fi
+
 PHP_CHECK_I18N_FUNCS
 
 PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c 
crc32.c crypt.c \
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/datetime.c?r1=1.138&r2=1.139&diff_format=u
Index: php-src/ext/standard/datetime.c
diff -u php-src/ext/standard/datetime.c:1.138 
php-src/ext/standard/datetime.c:1.139
--- php-src/ext/standard/datetime.c:1.138       Sun Aug 20 18:20:59 2006
+++ php-src/ext/standard/datetime.c     Thu Aug 24 11:05:38 2006
@@ -18,11 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: datetime.c,v 1.138 2006/08/20 18:20:59 iliaa Exp $ */
-
-#if HAVE_STRPTIME
-#define _XOPEN_SOURCE
-#endif
+/* $Id: datetime.c,v 1.139 2006/08/24 11:05:38 tony2001 Exp $ */
 
 #include "php.h"
 #include "zend_operators.h"
@@ -85,6 +81,10 @@
 
 
 #if HAVE_STRPTIME
+#ifndef HAVE_STRPTIME_DECL_FAILS
+char *strptime(const char *s, const char *format, struct tm *tm);
+#endif
+
 /* {{{ proto string strptime(string timestamp, string format)
    Parse a time/date generated with strftime() */
 PHP_FUNCTION(strptime)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to