Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
4027cab3
Commit
4027cab3
authored
Apr 15, 2014
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2240023
by beejeebus: Make sure we use a unique temp filename for php storage.
parent
562addaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php
...al/Component/PhpStorage/MTimeProtectedFastFileStorage.php
+4
-2
No files found.
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
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