@@ -1330,42 +1330,34 @@ error options:
13301330/* {{{ Send an error message somewhere */
13311331PHP_FUNCTION (error_log )
13321332{
1333- char * message , * opt = NULL , * headers = NULL ;
1334- size_t message_len , opt_len = 0 , headers_len = 0 ;
1333+ zend_string * message , * opt = NULL , * headers = NULL ;
13351334 zend_long erropt = 0 ;
13361335
13371336 ZEND_PARSE_PARAMETERS_START (1 , 4 )
1338- Z_PARAM_STRING (message , message_len )
1337+ Z_PARAM_STR (message )
13391338 Z_PARAM_OPTIONAL
13401339 Z_PARAM_LONG (erropt )
1341- Z_PARAM_PATH_OR_NULL (opt , opt_len )
1342- Z_PARAM_STRING_OR_NULL (headers , headers_len )
1340+ Z_PARAM_PATH_STR_OR_NULL (opt )
1341+ Z_PARAM_STR_OR_NULL (headers )
13431342 ZEND_PARSE_PARAMETERS_END ();
13441343
1345- if (_php_error_log_ex ((int ) erropt , message , message_len , opt , headers ) == FAILURE ) {
1344+ if (_php_error_log ((int ) erropt , message , opt , headers ) == FAILURE ) {
13461345 RETURN_FALSE ;
13471346 }
13481347
13491348 RETURN_TRUE ;
13501349}
13511350/* }}} */
13521351
1353- /* For BC (not binary-safe!) */
1354- PHPAPI int _php_error_log (int opt_err , const char * message , const char * opt , const char * headers ) /* {{{ */
1355- {
1356- return _php_error_log_ex (opt_err , message , (opt_err == 3 ) ? strlen (message ) : 0 , opt , headers );
1357- }
1358- /* }}} */
1359-
1360- PHPAPI int _php_error_log_ex (int opt_err , const char * message , size_t message_len , const char * opt , const char * headers ) /* {{{ */
1352+ PHPAPI zend_result _php_error_log (int opt_err , const zend_string * message , const zend_string * opt , const zend_string * headers ) /* {{{ */
13611353{
13621354 php_stream * stream = NULL ;
13631355 size_t nbytes ;
13641356
13651357 switch (opt_err )
13661358 {
13671359 case 1 : /*send an email */
1368- if (!php_mail (opt , "PHP error_log message" , message , headers , NULL )) {
1360+ if (!php_mail (ZSTR_VAL ( opt ) , "PHP error_log message" , ZSTR_VAL ( message ), ZSTR_VAL ( headers ) , NULL )) {
13691361 return FAILURE ;
13701362 }
13711363 break ;
@@ -1375,27 +1367,27 @@ PHPAPI int _php_error_log_ex(int opt_err, const char *message, size_t message_le
13751367 return FAILURE ;
13761368
13771369 case 3 : /*save to a file */
1378- stream = php_stream_open_wrapper (opt , "a" , REPORT_ERRORS , NULL );
1370+ stream = php_stream_open_wrapper (ZSTR_VAL ( opt ) , "a" , REPORT_ERRORS , NULL );
13791371 if (!stream ) {
13801372 return FAILURE ;
13811373 }
1382- nbytes = php_stream_write (stream , message , message_len );
1374+ nbytes = php_stream_write (stream , ZSTR_VAL ( message ), ZSTR_LEN ( message ) );
13831375 php_stream_close (stream );
1384- if (nbytes != message_len ) {
1376+ if (nbytes != ZSTR_LEN ( message ) ) {
13851377 return FAILURE ;
13861378 }
13871379 break ;
13881380
13891381 case 4 : /* send to SAPI */
13901382 if (sapi_module .log_message ) {
1391- sapi_module .log_message (message , -1 );
1383+ sapi_module .log_message (ZSTR_VAL ( message ) , -1 );
13921384 } else {
13931385 return FAILURE ;
13941386 }
13951387 break ;
13961388
13971389 default :
1398- php_log_err_with_severity (message , LOG_NOTICE );
1390+ php_log_err_with_severity (ZSTR_VAL ( message ) , LOG_NOTICE );
13991391 break ;
14001392 }
14011393 return SUCCESS ;
0 commit comments