Search

I have just updated to Sym 2.1, but am getting the following bug/problem.

I have a field called ‘attachment’, which is a File Upload field. It is set to optional. However, I find that even if I have left the field blank, Sym still outputs the item in XML, but with an empty filename, as below. This did not use to happen before updating.

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

Your help would be appreciated.

Thanks, Nathanael

I don’t know how to prevent a blank field from appearing in the XML, but you can have your XSL ignore null values in the XML.

I’m not sure if that is intended behavior. But wisolman is correct, the XPath to select only attachments that have filenames would be something like:

/data/your-data-source/attachment[filename/node()]

Further reading

I find that even if I have left the field blank, Sym still outputs the item in XML, but with an empty filename

This is definitely a bug. Could you post a report on the Issues tracker please?

Fixed it here. Mind if you check?

@ashooner and wisolman
I had not though of that, it will provide a temporary fix. Thanks.

@brendo
I tried adding the line, but still get the above XML outputted. I tried updating the entry, and also created a new every, but still got the same result.

Thanks.

@brendo I had a look at the value of $data in line 179, it was as follows.

Array
(
    [file] => 
    [size] => 
    [mimetype] => 
    [meta] => 
) 

I then tried the following, the fix you suggested, but modified to this:

if (!is_array($data) or empty($data['file'])) return;

and the problem was resolved! I doubt the above is ideal. I don’t know enough to know how to fix it.

Thanks.

Create an account or sign in to comment.

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