Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
4027cab3
Commit
4027cab3
authored
Apr 15, 2014
by
webchick
Browse files
Issue
#2240023
by beejeebus: Make sure we use a unique temp filename for php storage.
parent
562addaf
Changes
1
Show whitespace changes
Inline
Side-by-side
core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php
View file @
4027cab3
...
...
@@ -70,8 +70,8 @@ public function save($name, $data) {
// Write the file out to a temporary location. Prepend with a '.' to keep it
// hidden from listings and web servers.
$temporary_path
=
$this
->
directory
.
'/.'
.
str_replace
(
'/'
,
'#'
,
$name
);
if
(
!@
file_put_contents
(
$temporary_path
,
$data
))
{
$temporary_path
=
tempnam
(
$this
->
directory
,
'.'
);
if
(
!
$temporary_path
||
!@
file_put_contents
(
$temporary_path
,
$data
))
{
return
FALSE
;
}
// The file will not be chmod() in the future so this is the final
...
...
@@ -102,6 +102,8 @@ public function save($name, $data) {
// Reset the file back in the temporary location if this is not the first
// iteration.
if
(
$i
>
0
)
{
$this
->
unlink
(
$temporary_path
);
$temporary_path
=
tempnam
(
$this
->
directory
,
'.'
);
rename
(
$full_path
,
$temporary_path
);
// Make sure to not loop infinitely on a hopelessly slow filesystem.
if
(
$i
>
10
)
{
...
...
Write
Preview
Supports
Markdown
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