@@ -178,7 +178,7 @@ static PHP_INI_MH(OnSetPrecision)
178
178
static PHP_INI_MH (OnChangeMemoryLimit )
179
179
{
180
180
if (new_value ) {
181
- PG (memory_limit ) = zend_atol (new_value -> val , new_value -> len );
181
+ PG (memory_limit ) = zend_atol (new_value -> val , ( int ) new_value -> len );
182
182
} else {
183
183
PG (memory_limit ) = 1 <<30 ; /* effectively, no limit */
184
184
}
@@ -364,7 +364,7 @@ static int php_get_display_errors_mode(char *value, int value_length)
364
364
*/
365
365
static PHP_INI_MH (OnUpdateDisplayErrors )
366
366
{
367
- PG (display_errors ) = (zend_bool ) php_get_display_errors_mode (new_value -> val , new_value -> len );
367
+ PG (display_errors ) = (zend_bool ) php_get_display_errors_mode (new_value -> val , ( int ) new_value -> len );
368
368
369
369
return SUCCESS ;
370
370
}
@@ -380,10 +380,10 @@ static PHP_INI_DISP(display_errors_mode)
380
380
381
381
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry -> modified ) {
382
382
tmp_value = (ini_entry -> orig_value ? ini_entry -> orig_value -> val : NULL );
383
- tmp_value_length = ini_entry -> orig_value -> len ;
383
+ tmp_value_length = ( int ) ini_entry -> orig_value -> len ;
384
384
} else if (ini_entry -> value ) {
385
385
tmp_value = ini_entry -> value -> val ;
386
- tmp_value_length = ini_entry -> value -> len ;
386
+ tmp_value_length = ( int ) ini_entry -> value -> len ;
387
387
} else {
388
388
tmp_value = NULL ;
389
389
tmp_value_length = 0 ;
@@ -672,7 +672,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
672
672
fd = VCWD_OPEN_MODE (PG (error_log ), O_CREAT | O_APPEND | O_WRONLY , 0644 );
673
673
if (fd != -1 ) {
674
674
char * tmp ;
675
- int len ;
675
+ size_t len ;
676
676
zend_string * error_time_str ;
677
677
678
678
time (& error_time );
@@ -688,8 +688,11 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
688
688
len = spprintf (& tmp , 0 , "[%s] %s%s" , error_time_str -> val , log_message , PHP_EOL );
689
689
#ifdef PHP_WIN32
690
690
php_flock (fd , 2 );
691
- #endif
691
+ /* XXX should eventually write in a loop if len > UINT_MAX */
692
+ php_ignore_value (write (fd , tmp , (unsigned )len ));
693
+ #else
692
694
php_ignore_value (write (fd , tmp , len ));
695
+ #endif
693
696
efree (tmp );
694
697
zend_string_free (error_time_str );
695
698
close (fd );
@@ -757,13 +760,13 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
757
760
int is_function = 0 ;
758
761
759
762
/* get error text into buffer and escape for html if necessary */
760
- buffer_len = vspprintf (& buffer , 0 , format , args );
763
+ buffer_len = ( int ) vspprintf (& buffer , 0 , format , args );
761
764
762
765
if (PG (html_errors )) {
763
766
replace_buffer = php_escape_html_entities (buffer , buffer_len , 0 , ENT_COMPAT , NULL TSRMLS_CC );
764
767
efree (buffer );
765
768
buffer = replace_buffer -> val ;
766
- buffer_len = replace_buffer -> len ;
769
+ buffer_len = ( int ) replace_buffer -> len ;
767
770
}
768
771
769
772
/* which function caused the problem if any at all */
@@ -813,9 +816,9 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
813
816
814
817
/* if we still have memory then format the origin */
815
818
if (is_function ) {
816
- origin_len = spprintf (& origin , 0 , "%s%s%s(%s)" , class_name , space , function , params );
819
+ origin_len = ( int ) spprintf (& origin , 0 , "%s%s%s(%s)" , class_name , space , function , params );
817
820
} else {
818
- origin_len = spprintf (& origin , 0 , "%s" , function );
821
+ origin_len = ( int ) spprintf (& origin , 0 , "%s" , function );
819
822
}
820
823
821
824
if (PG (html_errors )) {
@@ -837,9 +840,9 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c
837
840
function ++ ;
838
841
}
839
842
if (space [0 ] == '\0' ) {
840
- doclen = spprintf (& docref_buf , 0 , "function.%s" , function );
843
+ doclen = ( int ) spprintf (& docref_buf , 0 , "function.%s" , function );
841
844
} else {
842
- doclen = spprintf (& docref_buf , 0 , "%s.%s" , class_name , function );
845
+ doclen = ( int ) spprintf (& docref_buf , 0 , "%s.%s" , class_name , function );
843
846
}
844
847
while ((p = strchr (docref_buf , '_' )) != NULL ) {
845
848
* p = '-' ;
@@ -975,7 +978,7 @@ PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const
975
978
int buf_len ;
976
979
977
980
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM , NULL , error , 0 , buf , PHP_WIN32_ERROR_MSG_BUFFER_SIZE , NULL );
978
- buf_len = strlen (buf );
981
+ buf_len = ( int ) strlen (buf );
979
982
if (buf_len >= 2 ) {
980
983
buf [buf_len - 1 ] = '\0' ;
981
984
buf [buf_len - 2 ] = '\0' ;
@@ -1001,7 +1004,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
1001
1004
int buffer_len , display ;
1002
1005
TSRMLS_FETCH ();
1003
1006
1004
- buffer_len = vspprintf (& buffer , PG (log_errors_max_len ), format , args );
1007
+ buffer_len = ( int ) vspprintf (& buffer , PG (log_errors_max_len ), format , args );
1005
1008
1006
1009
/* check for repeated errors to be ignored */
1007
1010
if (PG (ignore_repeated_errors ) && PG (last_error_message )) {
@@ -1337,7 +1340,7 @@ PHP_FUNCTION(set_time_limit)
1337
1340
return ;
1338
1341
}
1339
1342
1340
- new_timeout_strlen = zend_spprintf (& new_timeout_str , 0 , ZEND_LONG_FMT , new_timeout );
1343
+ new_timeout_strlen = ( int ) zend_spprintf (& new_timeout_str , 0 , ZEND_LONG_FMT , new_timeout );
1341
1344
1342
1345
key = zend_string_init ("max_execution_time" , sizeof ("max_execution_time" )- 1 , 0 );
1343
1346
if (zend_alter_ini_entry_chars_ex (key , new_timeout_str , new_timeout_strlen , PHP_INI_USER , PHP_INI_STAGE_RUNTIME , 0 TSRMLS_CC ) == SUCCESS ) {
@@ -2526,7 +2529,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
2526
2529
int realfile_len ;
2527
2530
2528
2531
if (expand_filepath (primary_file -> filename , realfile TSRMLS_CC )) {
2529
- realfile_len = strlen (realfile );
2532
+ realfile_len = ( int ) strlen (realfile );
2530
2533
zend_hash_str_add_empty_element (& EG (included_files ), realfile , realfile_len );
2531
2534
primary_file -> opened_path = estrndup (realfile , realfile_len );
2532
2535
}
0 commit comments