-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.0]fix change undefined $cspValue to $row in method compileAutomaticCspH… #27835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@nielsnuebel Please provide test instructions for your PR. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/27835. |
zero-24
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm row is only valid here: https://github.com/joomla/joomla-cms/pull/27835/files#diff-0ea3df9101b205d7c283ccf8ef68d621R359-R381 everything outside this is not correct. I agree that the current is wrong to.
|
|
||
| // Append the script hashes placeholder | ||
| if ($scriptHashesEnabled && strpos($cspValue->directive, 'script-src') === 0) | ||
| if ($scriptHashesEnabled && strpos($row->directive, 'script-src') === 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is supposed to be $cspHeaderValue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may have to adjust the following line for a better name. https://github.com/joomla/joomla-cms/pull/27835/files#diff-0ea3df9101b205d7c283ccf8ef68d621L359
@wilsonge no it is not. It runs to the following errors when I change it to $cspHeaderValue.

|
@nielsnuebel Could you check @wilsonge 's comment above and implement the suggested change, i.e. change |
|
testing instructions:
|
|
Here is var_dump and var_dump Thus, one can assume |
|
|
||
| // Append the script hashes placeholder | ||
| if ($scriptHashesEnabled && strpos($cspValue->directive, 'script-src') === 0) | ||
| if ($scriptHashesEnabled && strpos($row->directive, 'script-src') === 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if ($scriptHashesEnabled && strpos($row->directive, 'script-src') === 0) | |
| if ($scriptHashesEnabled && strpos($cspHeaderkey, 'script-src') === 0) |
|
|
||
| // Append the style hashes placeholder | ||
| if ($styleHashesEnabled && strpos($cspValue->directive, 'style-src') === 0) | ||
| if ($styleHashesEnabled && strpos($row->directive, 'style-src') === 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if ($styleHashesEnabled && strpos($row->directive, 'style-src') === 0) | |
| if ($styleHashesEnabled && strpos($cspHeaderkey, 'style-src') === 0) |
|
Closing in favor of #28318 |


This PR solves the problem of an undefined variable $cspValue copied from the method setCspHeader to compileAutomaticCspHeaderRules.