Hey, Paul...
Although I haven't confirmed the same error under PHP 8.1, I suspect the
issue is the same.
WooCommerce 4.5.5 (last released 4.5 build) does not produce the error,
however, upgrading to 4.6.0 produces an immediate failure, which is logged:
Fatal error: Uncaught IntlException: Collator::__construct():
collator_create: unable to open ICU collator in <blah>
I'm not sure what's missing, though various web sources point to having to
reinstall the icu4c package (I assume that icu and libicu which we have are
icu4c, as we do not have specific icu4c packages available). I am loading
the intl.dll PHP module, as well.
The failing code seems to stem from includes/class-wc-core-functions.php
near line 1782, specifically:
/**
* Sort array according to current locale rules and maintaining index
association.
* By default tries to use Collator from PHP Internationalization Functions
if available.
* If PHP Collator class doesn't exists it fallback to removing accepts
from a array
* and by sorting with `uasort( $data, 'strcmp' )` giving support for ASCII
values.
*
* @since 4.6.0
* @param array $data List of values to sort.
* @param string $locale Locale.
* @return array
*/
function wc_asort_by_locale( &$data, $locale = '' ) {
// Use Collator if PHP Internationalization Functions (php-intl) is
available.
if ( class_exists( 'Collator' ) ) {
$locale = $locale ? $locale : get_locale();
$collator = new Collator( $locale );
$collator->asort( $data, Collator::SORT_STRING );
return $data;
}
$raw_data = $data;
array_walk(
$data,
function ( &$value ) {
$value = remove_accents( html_entity_decode( $value
) );
}
);
uasort( $data, 'strcmp' );
foreach ( $data as $key => $val ) {
$data[ $key ] = $raw_data[ $key ];
}
return $data;
}
I can confirm that *not* loading the intl.dll module allows the code to fall
back and render pages properly. I'm just not sure if I can safely disable
intl functions without breaking something else.
--
Lewis
-------------------------------------------------------------
Lewis G Rosenthal, CNA, CLP, CLE, CWTS, EA
Rosenthal & Rosenthal, LLC
www.2rosenthals.com
visit my IT blog
www.2rosenthals.net/wordpress
-------------------------------------------------------------