76
76
TIDY_OPEN_BASE_DIR_CHECK(Z_STRVAL_P(_val)); \
77
77
switch (tidyLoadConfig(_doc, Z_STRVAL_P(_val))) { \
78
78
case -1: \
79
- php_error_docref(NULL, E_WARNING, "Could not load configuration file '%s' ", Z_STRVAL_P(_val)); \
79
+ php_error_docref(NULL, E_WARNING, "Could not load configuration file \"%s\" ", Z_STRVAL_P(_val)); \
80
80
break; \
81
81
case 1: \
82
- php_error_docref(NULL, E_NOTICE, "There were errors while parsing the configuration file '%s' ", Z_STRVAL_P(_val)); \
82
+ php_error_docref(NULL, E_NOTICE, "There were errors while parsing the configuration file \"%s\" ", Z_STRVAL_P(_val)); \
83
83
break; \
84
84
} \
85
85
} \
@@ -158,7 +158,7 @@ if (php_check_open_basedir(filename)) { \
158
158
#define TIDY_SET_DEFAULT_CONFIG (_doc ) \
159
159
if (TG(default_config) && TG(default_config)[0]) { \
160
160
if (tidyLoadConfig(_doc, TG(default_config)) < 0) { \
161
- php_error_docref(NULL, E_WARNING, "Unable to load Tidy configuration file at '%s'. ", TG(default_config)); \
161
+ php_error_docref(NULL, E_WARNING, "Unable to load Tidy configuration file at \"%s\" ", TG(default_config)); \
162
162
} \
163
163
}
164
164
/* }}} */
@@ -289,12 +289,12 @@ static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value)
289
289
zend_long lval ;
290
290
291
291
if (!opt ) {
292
- php_error_docref (NULL , E_NOTICE , "Unknown Tidy Configuration Option '%s' " , optname );
292
+ php_error_docref (NULL , E_WARNING , "Unknown Tidy configuration option \"%s\" " , optname );
293
293
return FAILURE ;
294
294
}
295
295
296
296
if (tidyOptIsReadOnly (opt )) {
297
- php_error_docref (NULL , E_NOTICE , "Attempting to set read-only option '%s' " , optname );
297
+ php_error_docref (NULL , E_WARNING , "Attempting to set read-only option \"%s\" " , optname );
298
298
return FAILURE ;
299
299
}
300
300
@@ -356,8 +356,8 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil
356
356
}
357
357
358
358
if (ZEND_SIZE_T_UINT_OVFL (ZSTR_LEN (data ))) {
359
- php_error_docref ( NULL , E_WARNING , "Input string is too long" );
360
- RETURN_FALSE ;
359
+ zend_argument_value_error ( 1 , " is too long" );
360
+ RETURN_THROWS () ;
361
361
}
362
362
363
363
doc = tidyCreate ();
@@ -382,7 +382,7 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil
382
382
383
383
if (enc_len ) {
384
384
if (tidySetCharEncoding (doc , enc ) < 0 ) {
385
- php_error_docref (NULL , E_WARNING , "Could not set encoding '%s' " , enc );
385
+ php_error_docref (NULL , E_WARNING , "Could not set encoding \"%s\" " , enc );
386
386
RETVAL_FALSE ;
387
387
}
388
388
}
@@ -798,7 +798,7 @@ static int php_tidy_parse_string(PHPTidyObj *obj, char *string, uint32_t len, ch
798
798
799
799
if (enc ) {
800
800
if (tidySetCharEncoding (obj -> ptdoc -> doc , enc ) < 0 ) {
801
- php_error_docref (NULL , E_WARNING , "Could not set encoding '%s' " , enc );
801
+ php_error_docref (NULL , E_WARNING , "Could not set encoding \"%s\" " , enc );
802
802
return FAILURE ;
803
803
}
804
804
}
@@ -995,8 +995,8 @@ PHP_FUNCTION(tidy_parse_string)
995
995
}
996
996
997
997
if (ZEND_SIZE_T_UINT_OVFL (ZSTR_LEN (input ))) {
998
- php_error_docref ( NULL , E_WARNING , "Input string is too long" );
999
- RETURN_FALSE ;
998
+ zend_argument_value_error ( 1 , " is too long" );
999
+ RETURN_THROWS () ;
1000
1000
}
1001
1001
1002
1002
tidy_instanciate (tidy_ce_doc , return_value );
@@ -1058,13 +1058,13 @@ PHP_FUNCTION(tidy_parse_file)
1058
1058
obj = Z_TIDY_P (return_value );
1059
1059
1060
1060
if (!(contents = php_tidy_file_to_mem (ZSTR_VAL (inputfile ), use_include_path ))) {
1061
- php_error_docref (NULL , E_WARNING , "Cannot Load '%s' into memory%s" , ZSTR_VAL (inputfile ), (use_include_path ) ? " (Using include path)" : "" );
1061
+ php_error_docref (NULL , E_WARNING , "Cannot load \"%s\" into memory%s" , ZSTR_VAL (inputfile ), (use_include_path ) ? " (using include path)" : "" );
1062
1062
RETURN_FALSE ;
1063
1063
}
1064
1064
1065
1065
if (ZEND_SIZE_T_UINT_OVFL (ZSTR_LEN (contents ))) {
1066
- php_error_docref ( NULL , E_WARNING , "Input string is too long" );
1067
- RETURN_FALSE ;
1066
+ zend_value_error ( "Input string is too long" );
1067
+ RETURN_THROWS () ;
1068
1068
}
1069
1069
1070
1070
TIDY_APPLY_CONFIG_ZVAL (obj -> ptdoc -> doc , options );
@@ -1155,8 +1155,8 @@ PHP_FUNCTION(tidy_get_opt_doc)
1155
1155
opt = tidyGetOptionByName (obj -> ptdoc -> doc , optname );
1156
1156
1157
1157
if (!opt ) {
1158
- php_error_docref ( NULL , E_WARNING , "Unknown Tidy Configuration Option '%s'" , optname );
1159
- RETURN_FALSE ;
1158
+ zend_argument_value_error ( 2 , "is an invalid configuration option" );
1159
+ RETURN_THROWS () ;
1160
1160
}
1161
1161
1162
1162
if ( (optval = (char * ) tidyOptGetDoc (obj -> ptdoc -> doc , opt )) ) {
@@ -1299,8 +1299,8 @@ PHP_FUNCTION(tidy_getopt)
1299
1299
opt = tidyGetOptionByName (obj -> ptdoc -> doc , optname );
1300
1300
1301
1301
if (!opt ) {
1302
- php_error_docref ( NULL , E_WARNING , "Unknown Tidy Configuration Option '%s'" , optname );
1303
- RETURN_FALSE ;
1302
+ zend_argument_value_error ( 2 , "is an invalid configuration option" );
1303
+ RETURN_THROWS () ;
1304
1304
}
1305
1305
1306
1306
optval = php_tidy_get_opt_val (obj -> ptdoc , opt , & optt );
@@ -1350,13 +1350,13 @@ PHP_METHOD(tidy, __construct)
1350
1350
1351
1351
if (inputfile ) {
1352
1352
if (!(contents = php_tidy_file_to_mem (ZSTR_VAL (inputfile ), use_include_path ))) {
1353
- php_error_docref (NULL , E_WARNING , "Cannot Load '%s' into memory%s" , ZSTR_VAL (inputfile ), (use_include_path ) ? " (Using include path)" : "" );
1353
+ php_error_docref (NULL , E_WARNING , "Cannot load \"%s\" into memory%s" , ZSTR_VAL (inputfile ), (use_include_path ) ? " (using include path)" : "" );
1354
1354
return ;
1355
1355
}
1356
1356
1357
1357
if (ZEND_SIZE_T_UINT_OVFL (ZSTR_LEN (contents ))) {
1358
- php_error_docref ( NULL , E_WARNING , "Input string is too long" );
1359
- RETURN_FALSE ;
1358
+ zend_value_error ( "Input string is too long" );
1359
+ RETURN_THROWS () ;
1360
1360
}
1361
1361
1362
1362
TIDY_APPLY_CONFIG_ZVAL (obj -> ptdoc -> doc , options );
@@ -1386,13 +1386,13 @@ PHP_METHOD(tidy, parseFile)
1386
1386
}
1387
1387
1388
1388
if (!(contents = php_tidy_file_to_mem (ZSTR_VAL (inputfile ), use_include_path ))) {
1389
- php_error_docref (NULL , E_WARNING , "Cannot Load '%s' into memory%s" , ZSTR_VAL (inputfile ), (use_include_path ) ? " (Using include path)" : "" );
1389
+ php_error_docref (NULL , E_WARNING , "Cannot load \"%s\" into memory%s" , ZSTR_VAL (inputfile ), (use_include_path ) ? " (using include path)" : "" );
1390
1390
RETURN_FALSE ;
1391
1391
}
1392
1392
1393
1393
if (ZEND_SIZE_T_UINT_OVFL (ZSTR_LEN (contents ))) {
1394
- php_error_docref ( NULL , E_WARNING , "Input string is too long" );
1395
- RETURN_FALSE ;
1394
+ zend_value_error ( "Input string is too long" );
1395
+ RETURN_THROWS () ;
1396
1396
}
1397
1397
1398
1398
TIDY_APPLY_CONFIG_ZVAL (obj -> ptdoc -> doc , options );
@@ -1421,8 +1421,8 @@ PHP_METHOD(tidy, parseString)
1421
1421
}
1422
1422
1423
1423
if (ZEND_SIZE_T_UINT_OVFL (ZSTR_LEN (input ))) {
1424
- php_error_docref ( NULL , E_WARNING , "Input string is too long" );
1425
- RETURN_FALSE ;
1424
+ zend_argument_value_error ( 1 , " is too long" );
1425
+ RETURN_THROWS () ;
1426
1426
}
1427
1427
1428
1428
obj = Z_TIDY_P (object );
0 commit comments