Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
TaxTypeManager::__construct()
has a space in hook name and cache key:
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
parent::__construct('Plugin/Commerce/TaxType', $namespaces, $module_handler, 'Drupal\commerce_tax\Plugin\Commerce\TaxType\TaxTypeInterface', 'Drupal\commerce_tax\Annotation\CommerceTaxType');
$this->alterInfo('commerce_tax type_info');
$this->setCacheBackend($cache_backend, 'commerce_tax type_plugins');
}
While cache key with a space may not have an impact on overall functionality, alter hook name with a space in it makes it impossible to create an alter hook function since PHP does not allow functions have spaces in their names (e.g., function hook_commerce_tax type_info_alter(&$info) {}
).
Comment | File | Size | Author |
---|---|---|---|
#3 | tax_type_manager_invalid_alter_hook-2895908-3.diff | 3 KB | maijs |
#2 | tax_type_manager_invalid_alter_hook-2895908-2.diff | 863 bytes | maijs |
Comments
Comment #2
maijs CreditAttribution: maijs at Wunder commentedA patch (without tests) is attached.
Comment #3
maijs CreditAttribution: maijs at Wunder commentedA patch (with a test) is attached.
Comment #4
maijs CreditAttribution: maijs at Wunder commentedWhile tests fail (they are not related to this issue), I'm marking it as Needs review.
Comment #6
bojanz CreditAttribution: bojanz at Centarro commentedCommitted #2, we're basically fixing a typo here, the test doesn't seem needed.
Thank you for both patches, in any case. Greatly appreciated.