Releases: PaulArgoud/woocommerce-subscriptions-tax-retrofit
Releases · PaulArgoud/woocommerce-subscriptions-tax-retrofit
Release list
1.4.4
Consistency
- Unescaped
$interrupted_offsetin resume form:get_option('wc_tax_retrofit_current_offset')output was interpolated directly in an HTML hidden inputvalueattribute withoutintval(). Internal integer with no user input path, but inconsistent with the systematic escaping applied in v1.4.2. Fixed withintval() - Unescaped
$checkedin status checkboxes: hardcoded'checked'/''string output withoutesc_attr()in the subscription status fieldset, while the adjacent$status_keywas already escaped. Fixed withesc_attr()
1.4.3
Robustness
catch (Exception)→catch (\Throwable)inget_tax_rate_id(): the try/catch aroundWC_Tax::find_rates()only caughtException. ATypeErrororErrorthrown by WooCommerce would propagate uncaught. Fixed with\Throwable(consistent with the two catches inprocess()fixed in 1.4.1)- Missing
batch_sizeandoffsetkeys in tax-rate-not-found return: whenget_tax_rate_id()returnsnull,process()returned an early error array missingbatch_sizeandoffsetkeys, unlike all other return paths. Code consuming$stats['batch_size']or$stats['offset'](e.g.display_results()) would trigger an undefined index notice
Consistency
JSON_UNESCAPED_UNICODEin CLI simulate:wp tax-retrofit simulate --jsonoutput escaped Unicode characters (e.g. French accents as\u00e9). AddedJSON_UNESCAPED_UNICODEflag for readable output- Plugin header Description translated to English: the WordPress plugin header
Descriptionfield was still in French. Rewritten in English for consistency with the rest of the project documentation
1.4.2
Consistency
- Systematic escaping in
display_results():$mode_color,$percent,$processed,$stats['total'],$stats['batch_size'],$stats['offset'],$stats['updated'],$stats['skipped'],$stats['errors'],$remaining,$eta_minutes,$eta_sec_remainand$nextwere interpolated directly in HTML output withoutintval()oresc_attr(). All internal values with no user input path, but inconsistent with the rest of the plugin which escapes systematically. Fixed withintval()for integers andesc_attr()for attributes - Unescaped
$stylein tax rate debug table: hardcoded CSS string output withoutesc_attr()inadmin_page(). Fixed - Unescaped
$diffin tax rate debug table: float difference output withoutesc_html()while all other values in the same table row were escaped. Fixed withesc_html(number_format(...)) - Loose comparison
==for rate selection:$current_rate_id == $rate_idused loose comparison wherenull == 0evaluates totrue. Replaced with(int) === (int)strict comparison - Redundant tolerance validation:
validate_tolerance()and a manual bounds check were both applied on the same input. Simplified to a singlevalidate_float()call - Translation file version headers:
.pot,fr_FR.poanden_US.postill referenced version 1.4.0 instead of current version
1.4.1
Robustness
catch (Exception)→catch (\Throwable): both try/catch blocks inprocess()(per-subscription transaction + outer loop) only caughtException. In PHP 7+,TypeErrorandErrorare not subclasses ofException— a WooCommerceTypeErrorcrash would leave the transaction open without ROLLBACK. Fixed with\Throwable- Float comparison
== 0indetect_no_tax_date():array_sum($taxes['total']) == 0could produce a false positive for values very close to 0 (e.g. 0.0001). Replaced withabs(array_sum($taxes['total'])) < 0.001
Performance
- Transient cache for
detect_no_tax_date(): automatic date detection (N+1 queries across 50 subscriptions) ran on every admin page load when no date was configured. Result now cached in a 5-minute transient (wc_tax_retrofit_detect_date_desc/_asc) - Static cache for
get_tax_rate_id(): tax rate lookup (up to 4 DB queries) was not cached, unlike other getters. Addedstaticcache with dual variables ($cached+$cached_resolved) to support thenullcase - Static cache for
count_subscriptions(): total count (wcs_get_subscriptionswithlimit => -1) was not cached. Addedstaticcache and deduplicated the inline code inprocess()that replicated the same logic
Consistency
$wpdb->prepare()on debug query step 4: the only SQL query in the plugin not usingprepare()(available rates listing inget_tax_rate_id()). Fixed withLIMIT %d- Sanitize
$_POST['statuses']: status checkboxes input was not passed throughsanitize_text_field()beforevalidate_statuses(). Near-zero risk (whitelist downstream) but inconsistent with other inputs - Cleanup
detect_date_*transients: both new transients are now deleted indeactivate()anduninstall.php
Documentation
- README.md: 3 occurrences of the old name
woocommerce-subscription-tax-retrofitcorrected towcs-tax-retrofit(renamed since v1.3.5)
v1.4.0
Full internationalization
- ~70 untranslatable UI strings: most admin interface texts (
admin_page(),display_results(),ajax_count(), CSV headers) were raw French without__()calls. All strings now wrapped in__(),esc_html__()oresc_js()as appropriate. Translation files grew from ~62 to ~130 entries - Regenerated .po/.pot files: all 3 translation files rewritten with new entries and updated versions
Fixes
- Missing
batch_sizeandcsv_data: the$statsarray returned on dependency errors inprocess()lackedbatch_size,offsetandcsv_datakeys, causingundefined indexin calling code get_all_tax_rates()without$wpdb->prepare(): SQL query used direct interpolation instead of$wpdb->prepare(), inconsistent with the rest of the plugin. Fixed with parameterizedLIMIT %d