Forums

Fatal Error using beta GSheet action

Nuvelle 31 Jan, 2016
Hey,

I have installed the beta GSheet action and set it up following the guide, but when I try to submit I get a fatal PHP error:


Fatal error: require_once() [function.require]: Failed opening required '/home/martinpr/public_html/cross/niche2/components/com_chronoforms5/extras/Google/autoload.php' (include_path='.:/usr/local/php53/pear') in /home/martinpr/public_html/cross/niche2/administrator/components/com_chronoforms5/chronoforms/actions/gsheet_save_gh/gsheet_save_gh.php on line 83


I had to create the /Google/ directory to upload the .p12 key, so installing it didnt create it, is that normal?

Many thanks!
Nuvelle 31 Jan, 2016
Sorry, had a derp moment - didnt realise there was more than 1 file inside the one i downloaded, and didnt see the readme!!

New issue though:

[7] => Array
        (
            [GSheet Save [GH]] => 400

The entity name must immediately follow the '&' in the entity reference.

        )

)



Any ideas how to resolve this one?
GreyHead 31 Jan, 2016
Hi Nuvelle,

Where are you seeing that error output? From the ChronoForms Debugger? Not something that I've seen before.

If it's from the DeBugger please post the rest of the Debugger output.

From Google it looks as though the message is usually an error when you are using XML.

Bob

PS I do add UNZIP to the file name as a clue . . .
Nuvelle 31 Jan, 2016
Sorry, this is via a debugger:

Data Array
Array
(
    [option] => com_chronoforms5
    [chronoform] => Award2016
    [event] => submit
    [GSheet] => Array
        (
            [yourname] => Your Name & Company
            [youremail] => ...
            [yournumber] => 077777
            [awardcategory] => 1
            [nomination] => Your Nomination (Person/Organisation)
            [reason] => Reasons for nominating this person/organisation:
        )

    [button7] => Submit
    [e0d2e9b9eb92725edb2d75e6be8ae86c6ada1b2e] => 1
    [ip_address] => ...
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
    [2] => Array
        (
            [Check Honeypot] => Array
                (
                    [0] => Honeypot check passed.
                )

        )

    [5] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:...
                    [2] => Subject:Award nomination
                    [3] => From name:Nuvelle Web Solutions
                    [4] => From email:...
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:
                    [8] => Reply email:
                    [9] => Attachments:
                    [10] => Array
                        (
                        )

                    [11] => Body:
<table>
<tr><td></td><td>Your Name & Company</td></tr>
<tr><td></td><td>...</td></tr>
<tr><td></td><td>077777</td></tr>
<tr><td></td><td>1</td></tr>
<tr><td></td><td>Your Nomination (Person/Organisation)</td></tr>
<tr><td></td><td>Reasons for nominating this person/organisation:</td></tr>
</table><br /><br />IP: ...
                )

        )

    [7] => Array
        (
            [GSheet Save [GH]] => 400

The entity name must immediately follow the '&' in the entity reference.

        )

)
GreyHead 31 Jan, 2016
Hi Nuvelle,

Just a guess but please try testing using 'Your name and Company' instead of 'Your Name & Company'.

If that is the problem I can work out a fix.

Bob
Nuvelle 31 Jan, 2016
That did it!!

    [7] => Array
        (
            [GSheet Save [GH]] => 201

<?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:gsx='http://schemas.google.com/spreadsheets/2006/extended'><id>https://spreadsheets.google.com/feeds/list/1wBmpMjqso9hxklSzZaF09AwoX9jd0lH_IrnaQPi0ugw/od6/private/full/cokwr</id><updated>2016-01-31T00:15:35.293Z</updated><category scheme='http://schemas.google.com/spreadsheets/2006' term='http://schemas.google.com/spreadsheets/2006#list'/><title type='text'>Your Name and Company</title><content type='text'>youremail: t.abbott@nuvelle.co.uk, yournumber: 77777, awardcategory: 1, nomination: Your Nomination (Person/Organisation)</content><link rel='self' type='application/atom+xml' href='https://spreadsheets.google.com/feeds/list/1wBmpMjqso9hxklSzZaF09AwoX9jd0lH_IrnaQPi0ugw/od6/private/full/cokwr'/><link rel='edit' type='application/atom+xml' href='https://spreadsheets.google.com/feeds/list/1wBmpMjqso9hxklSzZaF09AwoX9jd0lH_IrnaQPi0ugw/od6/private/full/cokwr/700d2fd803b0n'/><gsx:yourname>Your Name and Company</gsx:yourname><gsx:youremail>t.abbott@nuvelle.co.uk</gsx:youremail><gsx:yournumber>77777</gsx:yournumber><gsx:awardcategory>1</gsx:awardcategory><gsx:nomination>Your Nomination (Person/Organisation)</gsx:nomination></entry>

        )

)


Can you let me know when you have the fix? Some company names may have & in them, and the "reason" box too!
GreyHead 31 Jan, 2016
Hi Nuvelle,

Please try this - edit the file /administrator/components/com_chronoforms5/chronoforms/actions/gsheet_save_gh/gsheet_save_gh.php around line 170 to add the extra line shown here
    // convert data to XML format
    $entries = array();
    foreach ( $data as $k => $v ) {
      $k = strtolower($k);
      $v = htmlspecialchars($v, ENT_XML1); // add this line
      $entries[] = "<gsx:{$k}>{$v}</gsx:{$k}>"; 
    }

Bob
Nuvelle 31 Jan, 2016
I added in the line and now get the following GSheet error instead (with or without special characters):

    [7] => Array
        (
            [GSheet Save [GH]] => 404

No such entry

        )

)


If i remove your change it allows me to submit without the & characters again.
Nuvelle 31 Jan, 2016
Added detail: I tried 3 times and got the above error, when i changed the code back and tested, the google sheet had 3 blank rows.

So it inserted a blank row, but not my data!
GreyHead 31 Jan, 2016
Hi Marc,

It's working when I test
[attachment=0]2016-01-31_15-26-27.png[/attachment]

The 'No such entry'' message seems to happen when an empty row is submitted.

Please try adding this line of debug code after the htmlspecialcharacters line to see what data is being created.

      echo'<div>$v: '.print_r($v, true).'</div>';


Bob
Nuvelle 01 Feb, 2016
Added that in and I got the following echo'ed:


$v:
$v:
$v:
$v:
$v:
$v:
Nuvelle 01 Feb, 2016
The fill debug is:

Array
(
    [2] => Array
        (
            [Check Honeypot] => Array
                (
                    [0] => Honeypot check passed.
                )

        )

    [5] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:t.abbott@nuvelle.co.uk
                    [2] => Subject:Award nomination
                    [3] => From name:Nuvelle Web Solutions
                    [4] => From email:t.abbott@nuvelle.co.uk
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:
                    [8] => Reply email:
                    [9] => Attachments:
                    [10] => Array
                        (
                        )

                    [11] => Body:
<table>
<tr><td></td><td>Your Name & Company</td></tr>
<tr><td></td><td>t.abbott@nuvelle.co.uk</td></tr>
<tr><td></td><td>0778</td></tr>
<tr><td></td><td>1</td></tr>
<tr><td></td><td>Your Nomination (Person/Organisation)</td></tr>
<tr><td></td><td>test 1</td></tr>
</table><br /><br />IP: 80.45.134.209
                )

        )

    [7] => Array
        (
            [GSheet Save [GH]] => 404

No such entry

        )

)
Nuvelle 01 Feb, 2016
Sorry to keep spamming the topic, i added the debug line for the $k variable too just to check:

$k: yourname
$v:
$k: youremail
$v:
$k: yournumber
$v:
$k: awardcategory
$v:
$k: nomination
$v:
$k: reason
$v:


For some reason the $v now isnt being picked upface-meh-blank
Nuvelle 01 Feb, 2016
One last one for me as i am getting too tired to function, added another debug line in case it helps. The code really doesnt like the special chars translation!

    foreach ( $data as $k => $v ) {
      $k = strtolower($k);
	  echo'<div>pre $v: '.print_r($v, true).'</div>';
	  $v = htmlspecialchars($v, ENT_XML1); // add this line
	  echo'<div>$k: '.print_r($k, true).'</div>';
	  echo'<div>$v: '.print_r($v, true).'</div>';
      $entries[] = "<gsx:{$k}>{$v}</gsx:{$k}>"; 
    }



pre $v: Your Name & Company
$k: yourname
$v:
pre $v: t.abbott@nuvelle.co.uk
$k: youremail
$v:
pre $v: 07781
$k: yournumber
$v:
pre $v: 1
$k: awardcategory
$v:
pre $v: Your Nomination (Person/Organisation)
$k: nomination
$v:
pre $v: test 3!
$k: reason
$v:
GreyHead 01 Feb, 2016
Answer
HI Nuvelle,

I'm at a bit of a loss here - I can't see what is happening.

What PHP version are you using - the ENT_XML1 option was added in PHP 5.4 ?

What happens if you use just $v = htmlspecialchars($v); ?

Bob
Nuvelle 01 Feb, 2016
That got it! Everywhere else on the server is using 5.6+ but for some reason the one folder that holds this joomla install was set to use 5.3!

Updated it to 5.4 and it works fine now!

Thank you🙂
bobysha 02 Feb, 2016
Funny, as i heard some companies refuse using 5.6 version, saying that everything will work good.The fact is, my friend working in Germany told me once that they use 5.3 and don't want any changes and that makes him mad... i will tell him to show them this topic. Maybe they will realize that everything is changing and we should be ready to it =-)
This topic is locked and no more replies can be posted.