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

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.

<attachment size="4 KB" path="[path-to]/public_html" type="">
    <filename />
</attachment>

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.

2010/07/29 12:39:16 > WARNING: 2 - unlink(/{path-to}/public_html/workspace/uploads/articles/) [<a href='function.unlink'>function.unlink</a>]: Is a directory in file /{path-to}/public_html/symphony/lib/toolkit/class.general.php on line 645

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.

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.

  1. XML is added to the output even when there is no file uploaded
  2. 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.
  3. 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.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details