CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Fatal parser error on CSV import
Pages: [1]

Author Topic: Fatal parser error on CSV import  (Read 2867 times)

severdia

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 3.4.2
  • CMS version: Joomla 1.5.23
  • MySQL version: 5.0.92
  • PHP version: 5.2.16
Fatal parser error on CSV import
June 13, 2011, 06:38:36 pm
I'm trying to import a CSV file (UTF-8) with two rows and three values for each row (first name, last name, email). I map the fields and get to the last step, but once I click the final import button, i get the following error:

Fatal error: Call to undefined method Services_JSON::encodeUnsafe() in /home/marin/public_html/administrator/components/com_civicrm/civicrm/CRM/Import/Parser.php on line 336

Neither of the names nor emails are using any illegal characters. I've been through the forums, but haven't found any error like this. Any ideas?

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Fatal parser error on CSV import
June 14, 2011, 01:46:30 am
Can you replicate this on http://joomla.demo.civicrm.org with your sample CSV file. If you are able to replicate do file a bug report in Issue tracker and also attach your sample CSV file.

Thanks
Kurund
Found this reply helpful? Support CiviCRM

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Fatal parser error on CSV import
June 14, 2011, 03:25:46 am
Hi,
Think it  shouldn't use this class anyway, json_encode/json_decode are default on php 5

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

severdia

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 3.4.2
  • CMS version: Joomla 1.5.23
  • MySQL version: 5.0.92
  • PHP version: 5.2.16
Re: Fatal parser error on CSV import
June 14, 2011, 04:57:49 pm
It works on the demo site so I'm not sure what else is there. I have tried on a plain localhost installation like the demo site and it fails as well. I have the PHP memory limit set to 128MB. What else can I do?

corcken

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.1.0
  • CMS version: Wordpress 3.4.1
  • MySQL version: 5.1.63
  • PHP version: 5.2.12
Re: Fatal parser error on CSV import
August 07, 2012, 03:41:18 am
I'm having the same issue. Did anyone find a solution for this Problem?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Fatal parser error on CSV import
August 07, 2012, 06:00:21 am
Quote from: corcken on August 07, 2012, 03:41:18 am
I'm having the same issue. Did anyone find a solution for this Problem?

Upgrade to 4.1 if you haven't already.

If you have, can you describe the error message you have? it can't be the same as this thread from one year ago, the file has been modified.

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

corcken

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.1.0
  • CMS version: Wordpress 3.4.1
  • MySQL version: 5.1.63
  • PHP version: 5.2.12
Re: Fatal parser error on CSV import
August 07, 2012, 07:35:08 am
Right now i updated from 4.1.0 to 4.1.5 but i still have the Error:

Fatal error: Call to undefined method Services_JSON::encodeUnsafe() in /www/htdocs/w00f0a34/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Import/Parser.php on line 318

Before the update the errorline was a bit different (like 346)

I'm using  Wordpress 3.4.1
MySQL version: 5.1.63
PHP version: 5.2.12

Thank you for your answer.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Fatal parser error on CSV import
August 08, 2012, 05:57:03 am
Ah found it.

there is a better/faster json encoding native in php since years ago, we should change it.

Could you do a quick test and apply the patch attached?

Or you can manually do it
1) remove all the
-      require_once 'Services/JSON.php';
-      $json = new Services_JSON();
2)

replace $json->encodeUnsafe by json_encode

if it works for you, can you create an issue so I can modify it for the next version?

X+

X+

P.S. Your problem seems to be a conflict between civicrm pear version and another one. Not sure why.
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

corcken

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.1.0
  • CMS version: Wordpress 3.4.1
  • MySQL version: 5.1.63
  • PHP version: 5.2.12
Re: Fatal parser error on CSV import
August 09, 2012, 03:04:07 am
That worked for me. Thank you very much!

I will create an issue.

Thanks again for the fast reply!

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Fatal parser error on CSV import
August 10, 2012, 12:35:24 am
for tracking purpose: http://issues.civicrm.org/jira/browse/CRM-10640

Kurund
Found this reply helpful? Support CiviCRM

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Fatal parser error on CSV import

This forum was archived on 2017-11-26.