Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mahara
mahara
Commits
4ea130a5
Commit
4ea130a5
authored
Jun 17, 2019
by
Robert Lyon
Committed by
Gerrit Code Review
Jun 17, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Bug 1832803: Check for empty string before passing it to DOMDocument"
parents
9dc6e7de
323d7493
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
htdocs/artefact/comment/lib.php
htdocs/artefact/comment/lib.php
+4
-1
htdocs/testing/frameworks/behat/classes/BehatDataGenerators.php
.../testing/frameworks/behat/classes/BehatDataGenerators.php
+12
-10
No files found.
htdocs/artefact/comment/lib.php
View file @
4ea130a5
...
...
@@ -1172,12 +1172,15 @@ class ArtefactTypeComment extends ArtefactType {
/*
* Removes the classes from the text of the comment th
s
t could interfere
* Removes the classes from the text of the comment th
a
t could interfere
* with the comment display
* @param string $comment the text content of the comment
*/
public
static
function
remove_comments_classes
(
$comment
)
{
if
(
empty
(
$comment
))
{
return
""
;
}
$dom
=
new
DOMDocument
();
$dom
->
preserveWhiteSpace
=
false
;
$dom
->
formatOutput
=
true
;
...
...
htdocs/testing/frameworks/behat/classes/BehatDataGenerators.php
View file @
4ea130a5
...
...
@@ -380,15 +380,17 @@ class BehatDataGenerators extends BehatBase {
* @param array ('field' => 'values', ...) $record
* @return $record
*/
public
function
normalise
(
&
$record
)
{
foreach
(
$record
as
&
$value
)
{
$value
=
trim
(
$value
);
// Normalise boolean values
if
(
strtolower
(
$value
)
==
'on'
||
$value
==
'1'
||
$value
==
'true'
)
{
$value
=
true
;
}
else
if
(
strtolower
(
$value
)
==
'off'
||
$value
==
'0'
||
$value
==
'false'
)
{
$value
=
false
;
public
function
normalise
(
$availablefields
,
&
$record
)
{
foreach
(
$record
as
$fieldname
=>
&
$value
)
{
if
(
$availablefields
[
$fieldname
]
==
'bool'
)
{
$value
=
trim
(
$value
);
// Normalise boolean values
if
(
strtolower
(
$value
)
==
'on'
||
$value
==
'1'
||
$value
==
'yes'
||
$value
==
'true'
)
{
$value
=
true
;
}
else
if
(
strtolower
(
$value
)
==
'off'
||
$value
==
'0'
||
$value
==
'no'
||
$value
==
'false'
)
{
$value
=
false
;
}
}
}
}
...
...
@@ -447,7 +449,7 @@ class BehatDataGenerators extends BehatBase {
foreach
(
$data
->
getHash
()
as
$elementdata
)
{
// Normalise field values
$this
->
normalise
(
$elementdata
);
$this
->
normalise
(
$availablefields
,
$elementdata
);
// Validate available fields for given element
$this
->
validate_fields
(
$availablefields
,
$elementdata
);
// Check if all the required fields are there.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment