Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
reporting
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
reporting
Merge requests
!3
fix the issue
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
fix the issue
issue/reporting-3456486:3456486-warning-undefined-array
into
2.0.x
Overview
2
Commits
1
Pipelines
1
Changes
1
2 unresolved threads
Hide all comments
Open
Abhishek Gupta
requested to merge
issue/reporting-3456486:3456486-warning-undefined-array
into
2.0.x
9 months ago
Overview
2
Commits
1
Pipelines
1
Changes
1
2 unresolved threads
Hide all comments
Expand
0
0
Merge request reports
Compare
2.0.x
2.0.x (HEAD)
and
latest version
latest version
9deafe2d
1 commit,
9 months ago
1 file
+
9
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/Controller/ReportingEndpoint.php
+
9
−
4
Options
@@ -114,17 +114,22 @@ class ReportingEndpoint extends ControllerBase {
* The Request object.
*/
private
function
storeReportUriData
(
ReportingEndpointInterface
$reporting_endpoint
,
array
$report
,
Request
$request
)
{
// Provide default values for the 'csp-report' data if the key is missing.
$cspReport
=
isset
(
$report
[
'csp-report'
])
?
$report
[
'csp-report'
]
:
[
P
Patrick Kenny
@ptmkenny
9 months ago
Drupal generally uses snake case (
$csp_report
), not camelCase.
Please
register
or
sign in
to reply
'document-uri'
=>
'unknown'
,
// You can add other default values here if needed.
];
// Convert data to format expected by Reporting API.
$report
=
[
$report
Data
=
[
P
Patrick Kenny
@ptmkenny
9 months ago
snake_case?
Please
register
or
sign in
to reply
'age'
=>
0
,
'body'
=>
$
report
[
'
csp
-r
eport
'
]
,
'body'
=>
$csp
R
eport
,
'type'
=>
'csp-violation'
,
'url'
=>
$
report
[
'
csp
-r
eport
'
]
[
'document-uri'
],
'url'
=>
$csp
R
eport
[
'document-uri'
],
'user_agent'
=>
$request
->
headers
->
get
(
'User-Agent'
),
];
$this
->
storeReportToData
(
$reporting_endpoint
,
[
$report
]);
$this
->
storeReportToData
(
$reporting_endpoint
,
[
$report
Data
]);
}
/**
Loading
Drupal generally uses snake case (
$csp_report
), not camelCase.