From 9832e88a2775e7343a1722fd34f2101fa741fcf0 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 9 May 2013 12:41:14 +1000 Subject: [PATCH] Add missing macros to timelib_config.h The absence of HAVE_LIMITS_H caused timelib_structs.h to define LONG_MIN and LONG_MAX to be 32-bit values, which caused timelib_date_to_int() to give an error for a date after 2038, which caused the current time to be returned for e.g. date_create('28 July 2038')->format('r'). The issue was detected by MediaWiki unit tests, and this fix was tested by the same method. While I was at it, I also added HAVE_LOCALE_H, which was checked for in CMakeLists.txt but not used, and I fixed the definition of SIZEOF_INT (#cmakedefine doesn't work that way). I arranged the macros in timelib_config.h.cmake in the same order as they are in CMakeLists.txt. --- hphp/third_party/timelib/CMakeLists.txt | 1 + hphp/third_party/timelib/timelib_config.h.cmake | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hphp/third_party/timelib/CMakeLists.txt b/hphp/third_party/timelib/CMakeLists.txt index f121fe677..dab03cc62 100644 --- a/hphp/third_party/timelib/CMakeLists.txt +++ b/hphp/third_party/timelib/CMakeLists.txt @@ -29,6 +29,7 @@ TIME_CHECK_INCLUDE("limits.h") CHECK_TYPE_SIZE("int32_t" HAVE_INT32_T) CHECK_TYPE_SIZE("uint32_t" HAVE_UINT32_T) +CHECK_TYPE_SIZE("int" SIZEOF_INT) CHECK_FUNCTION_EXISTS("strtoll" HAVE_STRTOLL) CHECK_FUNCTION_EXISTS("atoll" HAVE_ATOLL) diff --git a/hphp/third_party/timelib/timelib_config.h.cmake b/hphp/third_party/timelib/timelib_config.h.cmake index efb3aa2a3..96fe7c249 100644 --- a/hphp/third_party/timelib/timelib_config.h.cmake +++ b/hphp/third_party/timelib/timelib_config.h.cmake @@ -1,10 +1,12 @@ #cmakedefine HAVE_SYS_TYPES_H 1 #cmakedefine HAVE_INTTYPES_H 1 #cmakedefine HAVE_STDINT_H 1 -#cmakedefine HAVE_STDLIB_H 1 #cmakedefine HAVE_STRING_H 1 +#cmakedefine HAVE_STDLIB_H 1 +#cmakedefine HAVE_LOCALE_H 1 +#cmakedefine HAVE_LIMITS_H 1 #cmakedefine HAVE_STRTOLL 1 #cmakedefine HAVE_ATOLL 1 #cmakedefine HAVE_INT32_T 1 #cmakedefine HAVE_UINT32_T 1 -#cmakedefine SIZEOF_INT 4 +#define SIZEOF_INT @SIZEOF_INT@