Hello all, After attempting to compile php on solaris as a 64 bit executable, and resolving the attempt to link libcrack (32bit lib), I was greated with a nice Bus Error.
Upon examining the source, it looks like their are alot of areas where longs and ints are used interchangeably. This is not good since a 64 bit solaris executable has 64 bit longs, and 32 bit ints. I have thrown together an initial patch that fixes this, but it does make make some changes that should be thought about. (such as using a long instead of an int for memmory limit and size counting) However, Overall it should not make too big a difference. (especially on the primarily targetted platforms whose ints and longs are the same) I did not check anything but the core extensions, so those will need to be looked at next. If no one throws any major objects, I will put together a better version of this patch and commit it upon completion. Thanks, -- Jason Greene <[EMAIL PROTECTED]>
? log_errors_max_len ? long_errors_max_len=10 ? phpt ? longint.patch Index: Zend/zend_alloc.c =================================================================== RCS file: /repository/Zend/zend_alloc.c,v retrieving revision 1.105 diff -u -r1.105 zend_alloc.c --- Zend/zend_alloc.c 18 Aug 2002 21:39:05 -0000 1.105 +++ Zend/zend_alloc.c 26 Sep 2002 03:41:57 -0000 @@ -376,7 +376,7 @@ } -ZEND_API int zend_set_memory_limit(unsigned int memory_limit) +ZEND_API long zend_set_memory_limit(unsigned long memory_limit) { #if MEMORY_LIMIT TSRMLS_FETCH(); Index: Zend/zend_alloc.h =================================================================== RCS file: /repository/Zend/zend_alloc.h,v retrieving revision 1.39 diff -u -r1.39 zend_alloc.h --- Zend/zend_alloc.h 18 Aug 2002 21:39:05 -0000 1.39 +++ Zend/zend_alloc.h 26 Sep 2002 03:41:57 -0000 @@ -108,7 +108,7 @@ #define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string)) #define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string)) -ZEND_API int zend_set_memory_limit(unsigned int memory_limit); +ZEND_API long zend_set_memory_limit(unsigned long memory_limit); ZEND_API void start_memory_manager(TSRMLS_D); ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC); Index: Zend/zend_globals.h =================================================================== RCS file: /repository/Zend/zend_globals.h,v retrieving revision 1.91 diff -u -r1.91 zend_globals.h --- Zend/zend_globals.h 23 Sep 2002 12:00:38 -0000 1.91 +++ Zend/zend_globals.h 26 Sep 2002 03:41:57 -0000 @@ -227,9 +227,9 @@ int fast_cache_stats[MAX_FAST_CACHE_TYPES][2]; #endif #if MEMORY_LIMIT - unsigned int memory_limit; - unsigned int allocated_memory; - unsigned int allocated_memory_peak; + unsigned long memory_limit; + unsigned long allocated_memory; + unsigned long allocated_memory_peak; unsigned char memory_exhausted; #endif }; Index: Zend/zend_ini.c =================================================================== RCS file: /repository/Zend/zend_ini.c,v retrieving revision 1.23 diff -u -r1.23 zend_ini.c --- Zend/zend_ini.c 23 Sep 2002 12:00:39 -0000 1.23 +++ Zend/zend_ini.c 26 Sep 2002 03:41:57 -0000 @@ -436,12 +436,12 @@ #else char *base; - base = (char *) ts_resource(*((int *) mh_arg2)); + base = (char *) ts_resource(*((long *) mh_arg2)); #endif p = (long *) (base+(size_t) mh_arg1); - *p = zend_atoi(new_value, new_value_length); + *p = zend_atol(new_value, new_value_length); return SUCCESS; } Index: Zend/zend_operators.c =================================================================== RCS file: /repository/Zend/zend_operators.c,v retrieving revision 1.124 diff -u -r1.124 zend_operators.c --- Zend/zend_operators.c 31 Aug 2002 20:53:48 -0000 1.124 +++ Zend/zend_operators.c 26 Sep 2002 03:41:57 -0000 @@ -36,9 +36,9 @@ #include "ext/bcmath/number.h" #endif -ZEND_API int zend_atoi(const char *str, int str_len) +ZEND_API long zend_atol(const char *str, int str_len) { - int retval; + long retval; if (!str_len) { str_len = strlen(str); Index: Zend/zend_operators.h =================================================================== RCS file: /repository/Zend/zend_operators.h,v retrieving revision 1.51 diff -u -r1.51 zend_operators.h --- Zend/zend_operators.h 30 Apr 2002 14:47:29 -0000 1.51 +++ Zend/zend_operators.h 26 Sep 2002 03:41:57 -0000 @@ -183,7 +183,7 @@ ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC); ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC); -ZEND_API int zend_atoi(const char *str, int str_len); +ZEND_API long zend_atol(const char *str, int str_len); #define convert_to_ex_master(ppzv, lower_type, upper_type) \ if ((*ppzv)->type!=IS_##upper_type) { \ Index: ext/mbstring/mbstring.c =================================================================== RCS file: /repository/php4/ext/mbstring/mbstring.c,v retrieving revision 1.99 diff -u -r1.99 mbstring.c --- ext/mbstring/mbstring.c 26 Sep 2002 00:53:47 -0000 1.99 +++ ext/mbstring/mbstring.c 26 Sep 2002 03:41:57 -0000 @@ -631,7 +631,7 @@ MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG; } else { MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - MBSTRG(filter_illegal_substchar) = zend_atoi(new_value, new_value_length); + MBSTRG(filter_illegal_substchar) = zend_atol(new_value, +new_value_length); } } Index: ext/standard/file.h =================================================================== RCS file: /repository/php4/ext/standard/file.h,v retrieving revision 1.65 diff -u -r1.65 file.h --- ext/standard/file.h 25 Sep 2002 15:25:11 -0000 1.65 +++ ext/standard/file.h 26 Sep 2002 03:41:57 -0000 @@ -114,7 +114,7 @@ int pclose_ret; size_t def_chunk_size; int auto_detect_line_endings; - int default_socket_timeout; + long default_socket_timeout; char *user_agent; } php_file_globals; Index: main/main.c =================================================================== RCS file: /repository/php4/main/main.c,v retrieving revision 1.491 diff -u -r1.491 main.c --- main/main.c 25 Sep 2002 16:11:31 -0000 1.491 +++ main/main.c 26 Sep 2002 03:41:58 -0000 @@ -152,10 +152,10 @@ */ static PHP_INI_MH(OnChangeMemoryLimit) { - int new_limit; + long new_limit; if (new_value) { - new_limit = zend_atoi(new_value, new_value_length); + new_limit = zend_atol(new_value, new_value_length); } else { new_limit = 1<<30; /* effectively, no limit */ } Index: main/php_globals.h =================================================================== RCS file: /repository/php4/main/php_globals.h,v retrieving revision 1.82 diff -u -r1.82 php_globals.h --- main/php_globals.h 1 Sep 2002 11:33:19 -0000 1.82 +++ main/php_globals.h 26 Sep 2002 03:41:58 -0000 @@ -76,7 +76,7 @@ zend_bool display_errors; zend_bool display_startup_errors; zend_bool log_errors; - int log_errors_max_len; + long log_errors_max_len; zend_bool ignore_repeated_errors; zend_bool ignore_repeated_source; zend_bool report_memleaks;
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php