Error message when custom fields have not values

Discussion in 'Developing, APIs and extending' started by Raph Mariage, Jun 29, 2012.

  1. Raph Mariage

    Raph Mariage New Member

    Hi !

    I can't update my custom fields on the tickets was merges.
    This bug relates to the issue marked at the following link :

    http://dev.kayako.com/browse/SWIFT-1809


    However, I have these scripts retrieving information with the API and allowing us to do statistics. These are very important to us. However, if no information is filled in custom fields, I get this error message:

    Fatal error: Uncaught exception 'Exception' with message 'String Could not be parsed as XML' in E: \ TrackingSiteSurvey \ EasyPHP \ EasyPHP-5.3.9 \ www \ KayakoAPILibrary \ kyHelpers.php: 19
    Stack trace:
    # 0 E: \ TrackingSiteSurvey \ EasyPHP \ EasyPHP-5.3.9 \ www \ KayakoAPILibrary \ kyHelpers.php (19): SimpleXMLElement-> __construct ('
    # 2 E: \ TrackingSiteSurvey \ EasyPHP \ EasyPHP-5.3.9 \ www \ KayakoAPILibrary \ kyBase.php (227): kyBase :: processRequest (NULL, 'GET', Array)
    # 3 E: \ TrackingSiteSurvey \ EasyPHP \ EasyPHP-5.3.9 \ www \ KayakoAPILibrary \ kyTicketCustomFieldGroup.php (30): kyBase _get :: (Array)
    # 4 E: \ TrackingSiteSurvey \ EasyPHP \ EasyPHP-5.3.9 \ www \ KayakoAPILibrary \ kyTicket.php (1017): kyTicketCustomFieldGroup getAll :: (379)
    # 5 E: \ TrackingSiteSurvey \ EasyPHP \ EasyPHP-5.3.9 \ www \ MajCustomField.php (133): kyTicket-> getCustomFieldGroups ()
    # 6 {main}
    thrown in E: \ TrackingSiteSurvey \ EasyPHP \ EasyPHP-5.3.9 \ www \ KayakoAPILibrary \ kyHelpers.php on line 19

    Here is the code for me to make the call on the API:

    $ Id = $ object-> getId ();
    $ ticket = kyTicket :: get ($ id);
    field_groups $ = $ ticket-> getCustomFieldGroups ();
    foreach ($field_groups as $field_group) {
    $FieldGroupTitle = $field_group-> getTitle ();
    switch ($ FieldGroupTitle) {
    case "Billing Information":
    $ field = $ field_group-> getFields ();
    foreach ($ field as $ field) {
    FiledTitle $ = $ field-> getTitle ();
    $ Value = $ field-> getValue ();
    switch ($ FiledTitle) {

    So how can I do to not get this error message ?
  2. Tomasz Sawicki

    Tomasz Sawicki Established Member

    Enable debug mode in PHP Library and check PHP error log to see what is sent by Kayako that could not be parsed as XML (I guess there will be some notices/warnings printed by Kayako).
  3. Raph Mariage

    Raph Mariage New Member

    Thanks for you answer. I'activated the debug mode.
    Follow, all warning and error :

    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 155: parser error : Opening and ending tag mismatch: contents line 152 and property in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: <property id_property="4"><![CDATA[Imprimé]]></property> in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 166: parser error : Sequence ']]>' not allowed in content in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ]]></contents> in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 166: parser error : Opening and ending tag mismatch: post line 135 and contents in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ]]></contents> in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 167: parser error : Opening and ending tag mismatch: posts line 34 and post in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: </post> in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 216: parser error : Opening and ending tag mismatch: ticket line 3 and posts in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: </posts> in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 217: parser error : Opening and ending tag mismatch: tickets line 2 and ticket in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: </ticket> in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 218: parser error : Extra content at the end of the document in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: </tickets> in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31
    Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31

    Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php:31
    Stack trace:
    #0 E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php(31): SimpleXMLElement->__construct('<?xml version="...')
    #1 E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyRESTClient.php(202): ky_xml_to_array('<?xml version="...')
    #2 E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyRESTClient.php(219): kyRESTClient->processRequest('/Tickets/Ticket', 'GET', Array)
    #3 E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyObjectBase.php(215): kyRESTClient->get('/Tickets/Ticket', Array)
    #4 E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\MajCustomField.php(138): kyObjectBase::get(656)
    #5 {main}
    thrown in E:\TrackingSiteSurvey\EasyPHP\EasyPHP-5.3.9\www\KayakoAPILibrary\kyHelpers.php on line 31


    Can you help me please ?
  4. Tomasz Sawicki

    Tomasz Sawicki Established Member

    It's something... but I also need the raw response sent by server. If you enabled PHP Library debug mode there should be lines starting from Sending REST request to Kayako. You can send it through private conversation.
  5. Niurka

    Niurka New Member

    Hi Tomasz, im having the same trouble when a try to get the ticket from the users. I enabled debug mode in PHP Library and throws me the following:

    [10-May-2014 14:13:41 America/New_York] PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: Entity: line 1: parser error : Start tag expected, '&lt;' not found in /home/xx/public_html/soporte/librerias/kyHelpers.php on line 31
    [10-May-2014 14:13:41 America/New_York] PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: Warning in /home/xx/public_html/soporte/librerias/kyHelpers.php on line 31
    [10-May-2014 14:13:41 America/New_York] PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: ^ in /home/xx/public_html/soporte/librerias/kyHelpers.php on line 31
    [10-May-2014 14:13:41 America/New_York] PHP Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/xx/public_html/soporte/librerias/kyHelpers.php:31
    Stack trace:
    #0 /home/xx/public_html/soporte/librerias/kyHelpers.php(31): SimpleXMLElement->__construct('Warning?Router:...')
    #1 /home/xx/public_html/soporte/librerias/kyRESTClient.php(192): ky_xml_to_array('Warning?Router:...')
    #2 /home/xx/public_html/soporte/librerias/kyRESTClient.php(220): kyRESTClient->processRequest('/Base/UserSearc...', 'POST', Array, Array, Array)
    #3 /home/xx/public_html/soporte/librerias/kyUser.php(271): kyRESTClient->post('/Base/UserSearc...', Array, Array)
    #4 /home/xx/public_html/soporte/login.php(47): kyUser::search('email of user')
    #5 {main}


    Plz, any help that you give me will be appreciated!
    Thanks.
    Last edited: May 12, 2014
  6. Tomasz Sawicki

    Tomasz Sawicki Established Member

    It seems, that Kayako sends some PHP warning (beginning with "Router:") instead of XML. To examine it further, please look for raw response from Kayako server in your logs and paste it here.

Share This Page