Postponed (maintainer needs more info)
Project:
Module Builder
Version:
4.2.6
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Aug 2026 at 07:51 UTC
Updated:
2 Sep 2026 at 13:31 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
gurkawal commentedHi
I have reproduced the issue on drupal 11.4 and php 8.4.
When executing the Module Builder code analysis task (/admin/config/development/module_builder/analyse), an AJAX 500 error occurs :
TypeError: count(): Argument #1 ($value) must be of type Countable|array, false given
The problem was caused by plugin IDs and service IDs being used directly inside regular expressions. If those values contain regex special characters, preg_grep() can fail or return unexpected results, which can break the schema prefix detection.
I have prepared a patch that fixes this by escaping the dynamic values with preg_quote() before using them in the regex. It also adds checks to safely skip processing when preg_grep() does not return a valid result.
I tested the change locally and confirmed that the plugin schema collection works correctly without the previous warnings/errors.
Patch attached for review and testing.
Comment #4
gurkawal commentedComment #5
nitinkumar_7 commentedAdd a regression test with a plugin ID containing regex characters, e.g. `foo.bar` or `foo+bar`, and verify the correct config schema is detected.
Also cover an unmatched/invalid regex case to confirm `
preg_grep()` returning `false` no longer causes a `count(false)` TypeError.Comment #6
nitinkumar_7 commentedAnd could you please open a follow-up MR
Comment #7
joachim commented> The problem was caused by plugin IDs and service IDs being used directly inside regular expressions. If those values contain regex special characters
Good catch, but I'm curious about what plugin IDs and service IDs can contain that's dangerous for a regex! They're always a-z_. so surely the . would just match itself?
I can't reproduce this on core 11.4.5, so presumably this is a misbehaving contrib or custom module. Which modules were you running in addition to core?
> if (empty($candidate_schema_ids) || !is_array($candidate_schema_ids)) {
This is needless -- if the return of preg_grep() is not an array, it's FALSE, and the empty() will already have caught it.
Comment #8
lblabr commentedho do i may support here?
Comment #9
lblabr commentedfails here ?