Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error with Polylang #1303

Open
pavelevap opened this issue Dec 12, 2017 · 7 comments
Open

Fatal error with Polylang #1303

pavelevap opened this issue Dec 12, 2017 · 7 comments
Labels
improvement Improvement of an existing functionality. See "feature" for new features. plugin support Issues related to the main feature of 4.0, plugin support.
Milestone

Comments

@pavelevap
Copy link
Collaborator

pavelevap commented Dec 12, 2017

[12-Dec-2017 11:10:28 UTC] Unknown column '' in 'where clause'. Query: SELECT * FROM `wp49_term_relationships` WHERE `` = '0'. Function: do_action('toplevel_page_mlang'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, PLL_Settings->languages_page, PLL_Settings->handle_actions, PLL_Admin_Model->set_language_in_mass, VersionPress\Database\WpdbMirrorBridge->query, VersionPress\Database\WpdbMirrorBridge->processInsertQuery, VersionPress\Database\Database->get_row, VersionPress\Database\Database->__call, call_user_func_array.

[12-Dec-2017 11:10:28 UTC] PHP Warning:  Invalid argument supplied for foreach() in C:\www\wp49\wp-content\plugins\versionpress\src\Database\VpidRepository.php on line 49

[12-Dec-2017 11:10:28 UTC] PHP Warning:  Invalid argument supplied for foreach() in C:\www\wp49\wp-content\plugins\versionpress\src\Database\VpidRepository.php on line 62

[12-Dec-2017 11:10:28 UTC] PHP Fatal error:  Call to a member function isIgnoredEntity() on null in C:\www\wp49\wp-content\plugins\versionpress\src\Storages\Storage.php on line 86

Probably small problem with Polylang leads to a fatal error for VersionPress.

@pavelevap pavelevap added the improvement Improvement of an existing functionality. See "feature" for new features. label Dec 12, 2017
@pavelevap pavelevap added this to the 4.0 milestone Dec 12, 2017
@pavelevap
Copy link
Collaborator Author

It seems to me that it is caused by following query (inserting multiple rows into a table): https://github.com/polylang/polylang/blob/852e5b1e616186eb19f8f68c23b29241cdbd8833/admin/admin-model.php#L319

Example: INSERT INTO wp_term_relationships ( object_id, term_taxonomy_id ) VALUES ( 1, 2 ),( 2, 2 )

VersionPress probably does not parse this query correctly.

@pavelevap pavelevap added the plugin support Issues related to the main feature of 4.0, plugin support. label Dec 12, 2017
@juanitopons
Copy link

Do you see any solution for integrating Polylang?

@pavelevap
Copy link
Collaborator Author

pavelevap commented Dec 13, 2017

@juanitopons: This issue is not the only problem (it is related only to mass assigning languages), I am trying to debug why some relationships are not correctly tracked by VersionPress.

@pavelevap
Copy link
Collaborator Author

After some further research it seems to me that problem is not query parsing, but missing entity for term_relationships (probably related issue #898).

Example query:
INSERT INTO wp_term_relationships ( object_id, term_taxonomy_id ) VALUES ( 1, 2 ),( 2, 2 )

Parsed object:

object(VersionPress\Database\ParsedQueryData)#4640 (7) {
  ["table"]=>
  string(23) "wp_term_relationships"
  ["entityName"]=>
  string(18) "term_relationships"
  ["ids"]=>
  NULL
  ["data"]=>
  array(2) {
    [0]=>
    array(2) {
      ["object_id"]=>
      string(1) "1"
      ["term_taxonomy_id"]=>
      string(1) "2"
    }
    [1]=>
    array(2) {
      ["object_id"]=>
      string(1) "2"
      ["term_taxonomy_id"]=>
      string(1) "2"
    }
  }
  ["sqlQuery"]=>
  string(82) "SELECT * FROM wp_term_relationships WHERE object_id='1' AND term_taxonomy_id='2'"
  ["idColumnsNames"]=>
  array(2) {
    [0]=>
    string(9) "object_id"
    [1]=>
    string(16) "term_taxonomy_id"
  }
  ["queryType"]=>
  string(6) "INSERT"
}

I am not sure about sqlQuery value, but nevermind.

So $entityName in processInsertQuery() is term_relationships

$entityName = $parsedQueryData->entityName;
and $entityInfo is NULL in this case
$entityInfo = $this->dbSchemaInfo->getEntityInfo($entityName);

And later it leads to unknown column error, warnings and fatal error in the end (see first post).

It is general VP error, but for Polylang it appears only in case of setting default language for all posts (after activating plugin).

@juanitopons
Copy link

juanitopons commented Dec 14, 2017

Well it sounds quite tricky to solve.
Actually, I'm experimenting weird behaviour when I apply-changes in enviroments cause of PolyLang versionpress bad syncrhonization.

SO, here is my question. Is there a way to stop VERSIONPRESS versioning specific plugin actions?
I would like to still use Polylang and Versionpress. Even if synchronization can't be stablished.

@pavelevap
Copy link
Collaborator Author

@juanitopons: This issue is not a big deal when you do not click to mass setting of default language. See issue #1306, this is the source of sync problems :-(

@sphule
Copy link

sphule commented May 23, 2019

Are there any further updates on this issue.
I am trying to use Polylang with Versionpress and facing the same error.

Polylang Bulk update with set_language_in_mass while setting default language breaks the database when apply-changes is used.

wp_term_relationships not having a primary key value and duplicate values for object_id breaks in versionpress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement of an existing functionality. See "feature" for new features. plugin support Issues related to the main feature of 4.0, plugin support.
Projects
None yet
Development

No branches or pull requests

3 participants