Author:
creativedutchmen
Version:
6.0
Released:
3 May 2011

Closed#2: Error on submitting event: null parameter for ksort()

I have created as simple an event as possible to test the email template.

I have a categories section that contains a single text input field: Title.

I created an email template that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml"
    omit-xml-declaration="yes"
    encoding="UTF-8"
    indent="yes" />

<xsl:template match="/">
    <xsl:text>The category was successfully created.</xsl:text>
    <xsl:copy-of select="." />
</xsl:template>
</xsl:stylesheet>

I created an event, Email: Category Created, and attatched it to a page, Email, with the following template:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    omit-xml-declaration="yes"
    encoding="UTF-8"
    indent="yes" />

<xsl:template match="/">
    <h1><xsl:value-of select="$page-title"/></h1>
    <form method="post" action="" enctype="multipart/form-data">
        <input name="MAX_FILE_SIZE" type="hidden" value="5242880" />
        <label>Title
            <input name="fields[title]" type="text" />
        </label>
        <input name="action[email-category-created]" type="submit" value="Submit" />
    </form>
</xsl:template>

</xsl:stylesheet>

When I enter a value of Email in the Title field and click on the Submit button, the following error is returned:

ksort() expects parameter 1 to be array, null given
/Users/stephen/Sites/domain7/team-members/extensions/email_template_manager/extension.driver.php line 133

128         return $needle;
129
130     }
131     
132     protected function _sendEmail($template, $context){
133         ksort($_POST['etm'], SORT_STRING);
134         $fields = Array();
135         $params = Array();
136         foreach((array)$_POST['etm'] as $handle => $values){
137         

The reason this didn't work was because you haven't specified any settings (recipients) for the event.

If you add an input field: <input type="hidden" name="etm[][recipients]" value="bauhouse" /> it whould work.

In the meantime, I'll fix the error (it is supposed to give a more descriptive error message ;))

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