Empty File Upload Showing in XML
A bug in 2.1.0, submitted by niwoodbridge on 29 July 2010
Announcement
Symphony's issue tracker has been moved to Github.
Issues are displayed here for reference only and cannot be created or edited.
Browse
Closed#375: Empty File Upload Showing in XML
Forum discussion here:
http://getsymphony.com/discuss/thread/48287/
Can you make sure the file is actually being saved in /workspace/uploads/articles/
?
@phoque
Yes, it is being saved in to /workspace/uploads/articles/
with 775 permission.
But when I try and remove the attached file, then save the item, the attached file is still there (and it has not been deleted form the server).
[removed]
We had this too.
Not sure why, but dirname()
behaves oddly on our dev machine (php 5.3).
So, to clarify, this appears to be 3 bugs in one.
- XML is added to the output even when there is no file uploaded
- There is a warning thrown to the logs when you save an entry, containing an upload field, with no file attached. Seems to also happen on deletion of the entry as well.
- File is not deleted from the disk when removing and saving.
As far as I can tell, #3 has already been fixed.
I believe that #1 is a result of NULL
rows in the database. The appendFormattedElement()
function is not checking the contents before outputting it.
And #2 is, I think, related to #1. It’s getting a NULL
row and thinking it contains data.
http://github.com/symphonycms/symphony-2/commit/0d8402286a9677fa80679ba66d19490f2c7c913e and http://github.com/symphonycms/symphony-2/commit/1f8a4aa985bdc6dc8228ef2fa58b035ab4550e69
Turns out, yes #2 was related to #1 in the way I described, however it was also caused by using file_exists()
instead of is_file()
. file_exists()
will return true if the path is a file or directory, hence the problem.
This issue is closed.
The following XML shows up in a page, even when a file is no attached. I did not have this problem before updating to 2.1.
As you can see an attachment element is still outputted (with an empty filename element) even when there is not file attached. I don’t believe this should happen.
Also everytime I try and save an entry, I get the following error.
Not sure what it means, but does not look healthy.
Trying the same thing out on a clean install of Symphony (with example workspace) gives the same result had the same result. Also tried same thing on another server, same problem.