Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Merge requests
!8807
Add test with broken property type.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Add test with broken property type.
issue/drupal-3462156:3462156-unhelpful-php-error
into
11.x
Overview
4
Commits
11
Pipelines
12
Changes
2
1 unresolved thread
Show all comments
Closed
Nikita Malyshev
requested to merge
issue/drupal-3462156:3462156-unhelpful-php-error
into
11.x
10 months ago
Overview
4
Commits
11
Pipelines
12
Changes
2
1 unresolved thread
Show all comments
Expand
Closes
#3462156
0
0
Merge request reports
Compare
11.x
version 10
a4b6c39c
7 months ago
version 9
ffd0f475
7 months ago
version 8
c10e9703
7 months ago
version 7
6a6b24d3
8 months ago
version 6
f2bf9201
9 months ago
version 5
8b2f0da7
9 months ago
version 4
35595b32
10 months ago
version 3
a6e83360
10 months ago
version 2
5bbf14d1
10 months ago
version 1
a553e8b2
10 months ago
11.x (base)
and
latest version
latest version
5f7ad929
11 commits,
7 months ago
version 10
a4b6c39c
10 commits,
7 months ago
version 9
ffd0f475
9 commits,
7 months ago
version 8
c10e9703
8 commits,
7 months ago
version 7
6a6b24d3
7 commits,
8 months ago
version 6
f2bf9201
6 commits,
9 months ago
version 5
8b2f0da7
5 commits,
9 months ago
version 4
35595b32
4 commits,
10 months ago
version 3
a6e83360
3 commits,
10 months ago
version 2
5bbf14d1
2 commits,
10 months ago
version 1
a553e8b2
1 commit,
10 months ago
2 files
+
49
−
8
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
core/lib/Drupal/Core/Theme/Component/ComponentValidator.php
+
22
−
0
Options
@@ -81,6 +81,28 @@ public function validateDefinition(array $definition, bool $enforce_schemas): bo
if
((
$schema
[
'properties'
]
??
NULL
)
===
[])
{
$schema
[
'properties'
]
=
new
\stdClass
();
}
// Ensure that all property types are strings. For example, a null value
// will not automatically convert to 'null', which will lead to a PHP error
// that is hard to trace back to the property.
$non_string_props
=
[];
\array_walk
(
$prop_names
,
function
(
string
$prop
)
use
(
&
$non_string_props
,
$schema
)
{
$type
=
$schema
[
'properties'
][
$prop
][
'type'
];
$types
=
!
\is_array
(
$type
)
?
[
$type
]
:
$type
;
$non_string_types
=
\array_filter
(
$types
,
static
fn
(
mixed
$type
)
=>
!
\is_string
(
$type
));
if
(
$non_string_types
)
{
$non_string_props
[]
=
$prop
;
}
});
if
(
$non_string_props
)
{
throw
new
InvalidComponentException
(
\sprintf
(
'The component "%s" uses non-string types for properties: %s.'
,
$definition
[
'id'
],
\implode
(
', '
,
$non_string_props
),
));
}
$classes_per_prop
=
$this
->
getClassProps
(
$schema
);
$missing_class_errors
=
[];
foreach
(
$classes_per_prop
as
$prop_name
=>
$class_types
)
{
Loading