projectnami icon indicating copy to clipboard operation
projectnami copied to clipboard

Yoast SEO plugin v9.0.3 Causes Compilation failed Error

Open RehanSaeed opened this issue 6 years ago • 12 comments

I updated my version of the Yoast SEO plugin to 9.0.3 and started getting the following errors at the top of my blog site at rehansaeed.com.

Warning: preg_replace(): Compilation failed: missing ) at offset 246 in D:\home\site\wwwroot\wp-includes\translations.php on line 1483
Warning: preg_replace(): Compilation failed: missing ) at offset 247 in D:\home\site\wwwroot\wp-includes\translations.php on line 1483
Warning: preg_replace(): Compilation failed: missing ) at offset 248 in D:\home\site\wwwroot\wp-includes\translations.php on line 1483
Warning: preg_replace(): Compilation failed: missing ) at offset 249 in D:\home\site\wwwroot\wp-includes\translations.php on line 1483
Warning: preg_replace(): Compilation failed: missing ) at offset 246 in D:\home\site\wwwroot\wp-includes\translations.php on line 1483
Warning: preg_replace(): Compilation failed: missing ) at offset 247 in D:\home\site\wwwroot\wp-includes\translations.php on line 1483
Warning: preg_replace(): Compilation failed: missing ) at offset 248 in D:\home\site\wwwroot\wp-includes\translations.php on line 1483
Warning: preg_replace(): Compilation failed: missing ) at offset 249 in D:\home\site\wwwroot\wp-includes\translations.php on line 1483

I've now uninstalled the plugin and even deleted it, then re-synced Project Nami from Azure deployments but the error remains. Any ideas on how I can fix this issue?

image

RehanSaeed avatar Nov 02 '18 11:11 RehanSaeed

The new version of Yoast (9.x ?) has a few issues on NAMI.

https://github.com/ProjectNami/projectnami/issues/284 https://github.com/ProjectNami/projectnami/issues/169

The quick and simple fix with this one is to edit the fields_map.parsed_types.php file in the wp-includes/ folder and update the mappings to include a paren at the end.

One of them will look something like: yoast_seo_links ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT,url varchar(255) NOT NULL,post_id bigint(20) unsigned NOT NULL,target_post_id bigint(20) unsigned NOT NULL,type VARCHAR(8) NOT NULL,PRIMARY KEY (id),KEY link_direction'

But should look like: yoast_seo_links ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT,url varchar(255) NOT NULL,post_id bigint(20) unsigned NOT NULL,target_post_id bigint(20) unsigned NOT NULL,type VARCHAR(8) NOT NULL,PRIMARY KEY (id),KEY link_direction )'

Not sure why it is doing this, but each time you reinstall the plugin or disable/reenable it, it will mess up that file again. You'll have to touch it by hand each time. Additionally, we now have translation issues with Yoast I have yet to be able to track down.

bcserverteam avatar Nov 20 '18 14:11 bcserverteam

This was happening to me as well. I have Yoast SEO v9.3 working with Project Nami v2.0.1.

The previous fix #169 did not fix the issue but I did keep it, just in case. What I did was this. Edit the translations.php file located in wp-includes and add these lines just after line 1482, which is foreach($operators as $oper => $val) {.

//line 1483
                    if ($table === 'wp_search_terms ( id bigint(20) NOT NULL AUTO_INCREMENT, search_term varchar(256) NOT NULL, search_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY') $table .= ')';
//line 1485
                    if ($table === 'wp_yoast_seo_links ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT,url varchar(255) NOT NULL,post_id bigint(20) unsigned NOT NULL,target_post_id bigint(20) unsigned NOT NULL,type VARCHAR(8) NOT NULL,PRIMARY KEY (id),KEY link_direction') $table .= ')';

Do not change the spacing in the query or it will fail the if/then.

Reload the Projects page or the Pages page and no more error.

If there are further issues just dump out the SQL statement by putting an

//line 1487
                    echo $table;

before the $query assignments so you can see the failing SQL statement. Hopefully it is something easy like a missing ).

Hope this helps. Cheers

NoralK avatar Dec 20 '18 01:12 NoralK

Is there a more permantent fix coming? I'd rather wait than hack around with PHP files.

RehanSaeed avatar Dec 20 '18 09:12 RehanSaeed

I believe the permanent fix will be to finally end the association with the fields map. It's a holdover from the plugin which the translation engine was adapted from. I think it might be replaced by querying the table structure from the DB, but haven't had the time to pursue it yet.

patrickebates avatar Dec 21 '18 02:12 patrickebates

Any plans to fix this?

RehanSaeed avatar Feb 26 '19 09:02 RehanSaeed

Yes, except that it slipped my mind recently. Need to make time to work on it.

patrickebates avatar Feb 26 '19 23:02 patrickebates

@patrickebates Any movement on this issue?

RehanSaeed avatar Jun 15 '19 09:06 RehanSaeed

Plugin is still returning this error... Please help!

OrbisEricCoumans avatar Aug 28 '19 08:08 OrbisEricCoumans

@patrickebates Any updates? Appreciate it may not be top of mind.

RehanSaeed avatar Oct 10 '19 19:10 RehanSaeed

Has this issue been fixed?

bcserverteam avatar Feb 25 '20 17:02 bcserverteam

There will be an announcement coming in a matter of days directly related to this issue. I'll do my best to remember to link to it from here once it's released.

patrickebates avatar Feb 25 '20 18:02 patrickebates

Here's that announcement as promised https://projectnami.org/changes-coming-in-2020/

patrickebates avatar Feb 29 '20 23:02 patrickebates