• Resolved jnorell

    (@jnorell)


    Hello,

    I’m trying to test the gdpr data export / delete features in WordPress 4.9.6, and I get the following error if I have the Popup Maker plugin activated: SyntaxError: Unexpected token < in JSON at position 0

    I’ve tried disabling every other plugins; with 0 plugins enabled, personal data export works, but with enabling just Popup Maker it returns that error.

    Steps to reproduce:

    1. I submit a data export request (or data delete, same error for both), confirm the email sent to me, then in the admin backend I click the ‘Download Personal Data’ link under Tools > Export Personal Data. Same thing happens with the ‘Email Data’ button on that page.
    2. It should email data to the user or download a personal data report file (zip’d .html file)
    3. Instead, the error is displayed: SyntaxError: Unexpected token < in JSON at position 0

    This is not a multisite install, and using Popup Maker version 1.7.22, php 7.0.30

    Thanks…

    • This topic was modified 6 years, 10 months ago by jnorell.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    @jnorell – Hmm, just tried and was unable to duplicate the issue locally. Got the export zip successfully.

    Must be an additional factor. I know you said you tried with just PM, but the error you reference sounds like a JS error. If that is the case we don’t use JS there and it would actually be an error generated in the core WP js for some reason.

    We have been testing this for a few weeks and not seen that issue, so I would start in your PHP error logs and see if there is anything helpful there.

    Have you tried switching to a default theme?

    Thread Starter jnorell

    (@jnorell)

    @danieliser This does not seem to be theme related. I just tried disabling all plugins (including must-use plugins, which I forgot last time), switched to twentyseventeen, and data export worked; I enabled Popup Maker and got the same error.

    The error is regarding the JSON data format, not any reference to JS. There are no javascript errors showing in the console, and the error is returned by a call to admin-ajax.php.

    Although that does lead to something useful: when I just clicked the export link, there were 4 calls made to admin-ajax.php, all with the ‘wp-privacy-export-personal-data’ action – 3 of them returned json formatted data, and the 4th one returned a snippet of html containing a wordpress database error; that html is not JSON, so likely where that error came from.

    The error itself is:
    WordPress database error: [Table ‘pantheon.wp_pum_subscribers’ doesn’t exist]

    SELECT ID, uuid, popup_id, email_hash, email, name, fname, lname, values, user_id, consent_args, consent, created FROM wp_pum_subscribers WHERE 1=1 AND (uuid LIKE ‘[email protected]’ OR email_hash LIKE ‘[email protected]’ OR email LIKE ‘[email protected]’ OR name LIKE ‘[email protected]’ OR fname LIKE ‘[email protected]’ OR lname LIKE ‘[email protected]’ OR values LIKE ‘[email protected]’ OR consent_args LIKE ‘[email protected]’ OR consent LIKE ‘[email protected]’ OR created LIKE ‘[email protected]’) ORDER BY ID ASC LIMIT 500

    And appended to that html error is some JSON text indicating success :).

    So I’m missing that wp_pum_subscribers table — any ideas what might have gone wrong there on our install, and/or a quick fix? We’ve had popup maker installed for some time (1-2 years), going through numerous updates. If you think it’s just our system that’s affected (interrupted plugin update or ??), I’ll get the table added and not worry about it. Then I’ll push updates from dev to test environment and see what happens. But if there’s anything obvious there which might need fixed, just holler if you need more info.

    Thanks!

    • This reply was modified 6 years, 10 months ago by jnorell.
    Thread Starter jnorell

    (@jnorell)

    the error is returned by a call to admin-ajax.php.the error is returned by a call to admin-ajax.php

    Correction (as I can’t edit my earlier comment now), there is an error returned from admin-ajax.php (see above), but it was not the JSON error. The JSON error I believe was generated because what admin-ajax.php returned was not just JSON, but an error message marked up with HTML tags, followed by JSON – so the error message regarding malformed JSON was accurate.

    Thread Starter jnorell

    (@jnorell)

    If helpful, this is from options on my dev site where this error happens:

        [pum_ver] => 1.7.22
        [_pum_installed_themes] => a:5:{i:0;s:8:"lightbox";i:1;s:15:"enterprise-blue";i:2;s:9:"hello-box";i:3;s:12:"cutting-edge";i:4;s:13:"framed-border";}
        [pum_db_ver] => 8
        [pum_total_open_count] => 381
        [pum_ver_upgraded_from] => 1.7.21
        [pum_reviews_installed_on] => 2017-03-10 16:54:51
        [pum_initial_version] => 1.6.4
        [pum_completed_upgrades] => a:2:{i:0;s:16:"core-v1_7-popups";i:1;s:18:"core-v1_7-settings";}
        [pum_subscribers_db_version] => 2
        [pum_version] => 1.7.21
    

    I tweaked PUM_Abstract_Database::__construct() to test for the existence of the database table (not just stored version number), and it now attempts to create that table – which fails, revealing the underlying source of my problem with wp_pum_subscribers not being created:

    WordPress database error: [Index column size too large. The maximum column size is 767 bytes.]
        CREATE TABLE wp_pum_subscribers (
    			ID BIGINT(20) NOT NULL AUTO_INCREMENT,
    			email_hash VARCHAR(255) NOT NULL,
    			popup_id BIGINT(20) NOT NULL,
    			user_id BIGINT(20) NOT NULL,
    			email VARCHAR(255) NOT NULL,
    			name VARCHAR(255) NOT NULL,
    			fname VARCHAR(255) NOT NULL,
    			lname VARCHAR(255) NOT NULL,
    			values LONGTEXT NOT NULL,
    			uuid VARCHAR(255) NOT NULL,
    			consent VARCHAR(255) NOT NULL,
    			consent_args LONGTEXT NOT NULL,
    			created DATETIME NOT NULL,
    		  PRIMARY KEY (ID),
    		  KEY email (email),
    		  KEY user_id (user_id),
    		  KEY popup_id (popup_id),
    		  KEY email_hash (email_hash)
    		) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
    

    Mysql version is what comes on pantheon’s hosting, currently: mysqlnd 5.0.12-dev – 20150407

    This same problem will happen not just for users of pantheon’s hosting, but a quick search indicates this will likely fail for everyone using utf8mb4 charset: https://stackoverflow.com/questions/42043205/how-to-fix-mysql-index-column-size-too-large-laravel-migrate#42043927

    The test for table existence might be worth keeping, I’ll post my changes once I work through it all. Right now I’m getting more familiar with charset/collate issues, but it seems the correct solution might be to explicitly set utf8 for the email and email_hash columns.

    • This reply was modified 6 years, 10 months ago by jnorell.
    • This reply was modified 6 years, 10 months ago by jnorell.
    • This reply was modified 6 years, 10 months ago by jnorell.
    • This reply was modified 6 years, 10 months ago by jnorell.
    Thread Starter jnorell

    (@jnorell)

    So this is what I ended up with that worked for me; you can evaluate if this is the proper fix for everyone or not. The underlying problem is you can’t create an index on a VARCHAR(255) column with the utf8mb4 charset.

    Another option that might work would be to create the table without indexing email and email_hash, then add those indexes in a second pass – which will still fail, but the end result is simply slower performance, rather than absolute failure. Not ideal, but it’s always nice to have options. ??

    Well, posting the patch didn’t convert well (backticks converted to <code> tags), here’s a pull request instead: https://github.com/PopupMaker/Popup-Maker/pull/566

    • This reply was modified 6 years, 10 months ago by jnorell.
    • This reply was modified 6 years, 10 months ago by jnorell.
    • This reply was modified 6 years, 10 months ago by jnorell.
    • This reply was modified 6 years, 10 months ago by jnorell.
    • This reply was modified 6 years, 10 months ago by jnorell.
    Plugin Author Daniel Iser

    (@danieliser)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Export Personal Data error’ is closed to new replies.