|
79 | 79 | _php_tidy_apply_config_array(_doc, _val_ht); \
|
80 | 80 | } else if (_val_str) { \
|
81 | 81 | TIDY_OPEN_BASE_DIR_CHECK(ZSTR_VAL(_val_str)); \
|
82 |
| - switch (tidyLoadConfig(_doc, ZSTR_VAL(_val_str))) { \ |
83 |
| - case -1: \ |
84 |
| - php_error_docref(NULL, E_WARNING, "Could not load configuration file \"%s\"", ZSTR_VAL(_val_str)); \ |
85 |
| - break; \ |
86 |
| - case 1: \ |
87 |
| - php_error_docref(NULL, E_NOTICE, "There were errors while parsing the configuration file \"%s\"", ZSTR_VAL(_val_str)); \ |
88 |
| - break; \ |
89 |
| - } \ |
| 82 | + php_tidy_load_config(_doc, ZSTR_VAL(_val_str)); \ |
90 | 83 | }
|
91 | 84 |
|
92 | 85 |
|
@@ -143,9 +136,7 @@ if (php_check_open_basedir(filename)) { \
|
143 | 136 |
|
144 | 137 | #define TIDY_SET_DEFAULT_CONFIG(_doc) \
|
145 | 138 | if (TG(default_config) && TG(default_config)[0]) { \
|
146 |
| - if (tidyLoadConfig(_doc, TG(default_config)) < 0) { \ |
147 |
| - php_error_docref(NULL, E_WARNING, "Unable to load Tidy configuration file at \"%s\"", TG(default_config)); \ |
148 |
| - } \ |
| 139 | + php_tidy_load_config(_doc, TG(default_config)); \ |
149 | 140 | }
|
150 | 141 | /* }}} */
|
151 | 142 |
|
@@ -269,6 +260,16 @@ static void TIDY_CALL php_tidy_panic(ctmbstr msg)
|
269 | 260 | php_error_docref(NULL, E_ERROR, "Could not allocate memory for tidy! (Reason: %s)", (char *)msg);
|
270 | 261 | }
|
271 | 262 |
|
| 263 | +static void php_tidy_load_config(TidyDoc doc, const char *path) |
| 264 | +{ |
| 265 | + int ret = tidyLoadConfig(doc, path); |
| 266 | + if (ret < 0) { |
| 267 | + php_error_docref(NULL, E_WARNING, "Could not load the Tidy configuration file \"%s\"", path); |
| 268 | + } else if (ret > 0) { |
| 269 | + php_error_docref(NULL, E_NOTICE, "There were errors while parsing the Tidy configuration file \"%s\"", path); |
| 270 | + } |
| 271 | +} |
| 272 | + |
272 | 273 | static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value)
|
273 | 274 | {
|
274 | 275 | TidyOption opt = tidyGetOptionByName(doc, optname);
|
|
0 commit comments