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

[Pods 2.8 Bug] testing on site using WPML gives error #5945

Closed
carlosrovira opened this issue Feb 12, 2021 · 54 comments
Closed

[Pods 2.8 Bug] testing on site using WPML gives error #5945

carlosrovira opened this issue Feb 12, 2021 · 54 comments

Comments

@carlosrovira
Copy link

Pods 2.8 version

version of Pods 2.8 running is: "2.8.0-b-1"

Description

Seems Pods 2.8 is not ready to use in production with WPML. I updated the plugin in our preproduction site and we are getting this:

string(1196) "Database Error; SQL: SELECT

            DISTINCT
            `t`.*
            FROM `wp_posts` AS `t`
            
                LEFT JOIN `wp_postmeta` AS `director` ON
                    `director`.`meta_key` = 'director'
                    AND `director`.`post_id` = `t`.`ID`
            
            
					LEFT JOIN `wp_icl_translations` AS `wpml_translations`
						ON `wpml_translations`.`element_id` = `t`.`ID`
							AND `wpml_translations`.`element_type` = 'post_empleado'
							AND `wpml_translations`.`language_code` = 'en'
				
            
					LEFT JOIN `wp_icl_languages` AS `wpml_languages`
						ON `wpml_languages`.`code` = `wpml_translations`.`language_code` AND `wpml_languages`.`active` = 1
				
            WHERE ( ( `director`.`meta_value` = 1 ) AND ( `t`.`post_type` = "empleado" ) AND ( `wpml_languages`.`code` IS NOT NULL ) AND ( `t`.`post_status` IN ( "publish" ) ) )
            
            
            ORDER BY `order`.`meta_value` ASC, `t`.`menu_order`, `t`.`post_title`, `t`.`post_date`
            LIMIT 0, 15; Response: Unknown column 'order.meta_value' in 'order clause'"

Just copied one of the errors. In that page you'll see one more.

Testing instructions

To see the problem in action check our preproduction site here: https://webpre.codeoscopic.com/en/group/

and you'll see the string above printed on the page.

Also in the "Management Team" section is empty. There we should get the management team employees info and then below a list of employees info.

This problem can be seen in the rest of pages using pods like "investors" and "clients", and "work with us" (link in the footer). In this one I see a reduced error:

string(20) "Objeto no encontrado"

That means "Object not found", so this could be related to pods not using now "Object"

Expected behavior

just to work as before. You can see the right output here in the production site with released pods version: https://codeoscopic.com/en/group/

In the current status I'll not be able to upgrade from pods 2.7 to 2.8. Hope a solution could be found in this beta time frame.

Possible workaround

No one found

Other super helpful information

WPML is using the all plugins at its latest official released version.

Thanks

@JoryHogeveen
Copy link
Member

@sc0ttkclark
Might be best to remove WPML code from our API and use filters for this?
That way we can make separate WPML / Polylang / Others classes for integration.

@JoryHogeveen JoryHogeveen added this to the Pods 2.8 milestone Feb 18, 2021
@carlosrovira
Copy link
Author

I think that will not solve the current problem and will make hundreds of WPML webs out there unable to upgrade to 2.8. A major change like that will make sense in a 3.0 release with sufficient plan to provide the alternative and a migration plan, but just removing WPML support from 2.8 seems to me like a bad movement for this project.

@JoryHogeveen
Copy link
Member

Hi @carlosrovira
I'm not talking about removing WPML support. I'm talking about refactoring this part so it's easier to manage.

@carlosrovira
Copy link
Author

Hi @JoryHogeveen , ok thanks. In that case, if it's a refactor to be better handled, then that will be cool. But maybe that will mean it could be possible for 2.8 timeframe?, or we'll need to wait to update?
Thanks

@sc0ttkclark
Copy link
Member

@JoryHogeveen that pathway sounds good to me

@carlosrovira
Copy link
Author

Hi @sc0ttkclark and @JoryHogeveen, please, if you can share whatever plan or time frame that will be good to know what to expect. If I need to freeze in 2.7 for sometime or I can expect to try 2.8 for WPML support. Thanks for your support!

@JoryHogeveen
Copy link
Member

JoryHogeveen commented Feb 25, 2021

Hi @carlosrovira
Took a closer look at the error and was wondering:

  • Where/How is this query called in your code? Is this a Pods shortcode or something?
  • Any idea where the property order is coming from. It looks like a custom field is included or something.

Cheers, Jory

@carlosrovira
Copy link
Author

Hi,

yes, in that page I have 2 shortcodes:
[pods name="empleado" orderby="order" where="director.meta_value = 1" template="EquipoDirectivo"]

and

[pods name="empleado" where="director.meta_value = 0" orderby="nombre.meta_value" template="Equipo" limit="40"]

Then order is a field of not formated number in the pod empleado.

HTH

Carlos

@JoryHogeveen
Copy link
Member

Hi @carlosrovira

If order is a field in the Pod empleado then you should use it as metadata: order.meta_value.
Keep in mind that you might need to order as numeric: https://stackoverflow.com/questions/489874/sql-order-chars-numerically

Cheers. Jory

@carlosrovira
Copy link
Author

Hi Jory,

I'm understand correctly that change 1 of the pods above to this:

[pods name="empleado" orderby="order.meta_value" where="director.meta_value = 1" template="EquipoDirectivo"]

I tried, but seems not to fix the issue, or is just a fix to be done but separated from the WPML problem?

Thanks for your help

@sc0ttkclark sc0ttkclark added the Status: In Progress Issue or PR is currently in progress but not yet done label Apr 18, 2021
@sc0ttkclark sc0ttkclark removed their assignment Apr 18, 2021
@JoryHogeveen
Copy link
Member

@carlosrovira

Sorry for my late reply.
But no, I mean that the order as a value for orderby isn't correct unless order is an actual field in your Pod.
However, it looks like nombre is your order field or am I incorrect in assuming this?

@JoryHogeveen
Copy link
Member

@carlosrovira Could you test the following PR: #6155

@JoryHogeveen JoryHogeveen linked a pull request Oct 1, 2021 that will close this issue
12 tasks
@carlosrovira
Copy link
Author

Hi @JoryHogeveen, I have currently a problem in the pre server where I can test it. I have it in my backlog for several days. Will try to fix this weekend and try it, and back here with my findings. Thanks

@carlosrovira
Copy link
Author

Hi @JoryHogeveen, after working several hours in the last weekend, I could solve my test server issues. Sorry to be late, but I need to migrate some webs to other server, upgrade SO, PHP, and even install packages that was not considered some years ago until get things working. I finally have the site up in the same state as production.

So from there, I updated Pods to latest RC1 downloading the zip and switching from the latest stable.

I found some things are solved since last time but we have still critical issues. Note that I have WP_DEBUG enabled and also I tried to remove pods cache to ensure issues was not coming from any stale state.

We have basically 3 pages that use Pods (Groups, Investors and Clients), and we have just 2 languages in WPML: Spanish (ES) and English (EN).

Here's my findings:

1.- In "Group" page, ES version is working fully as expected, but EN version don't show the pods parts: you can check https://webpre.codeoscopic.com/es/grupo/ vs https://webpre.codeoscopic.com/en/group/

2.- The same thing happens in "Investor" page.

3.- "Clients" page is not working at all and is reporting lots of issues that you can see printed in screen: https://webpre.codeoscopic.com/es/clientes/

Maybe I need to update some code, but I thing that should not be necessary since if the page is working in 2.7, it should be ok in 2.8 for a smooth transition. So I didn't try the change you proposed on Mar, 9, since at that time I have the server unoperative due to all the issue I said before. Also I didn't understand really what need to be changed.

I'm open to help trying things, and also we can talk if you need to operate in my pre instalation.

HTH

Carlos

@carlosrovira
Copy link
Author

carlosrovira commented Oct 5, 2021

hi,

In all EN wp admin pages I get this log (not happening in ES wp admin pages):

Notice: Trying to access array offset on value of type bool in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 422

Warning: Invalid argument supplied for foreach() in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 422

Notice: Trying to access array offset on value of type bool in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 422

Warning: Invalid argument supplied for foreach() in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 422

Notice: Trying to access array offset on value of type bool in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 422

Warning: Invalid argument supplied for foreach() in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 422

@JoryHogeveen
Copy link
Member

JoryHogeveen commented Oct 5, 2021

Hi @carlosrovira

Before we continue, did you test on the latest RC or with the integration patch?
By looking at your errors it seems that you've tested on the RC version, not the integration patch.
Please make sure you test on the patch:
Patch PR: #6155
Patch download ZIP: https://github.com/pods-framework/pods/archive/refs/heads/feature/2.8/i18n-integration.zip

As for your findings.
Please always also share how your results are fetched. Eg, your shortcode or template code. Otherwise it's very difficult or even impossible for me to find the issue.

EDIT: Also make sure you clear all Pods cache. When updating manual this might not be done automatically.

Let me know!

Cheers, Jory

@JoryHogeveen
Copy link
Member

JoryHogeveen commented Oct 18, 2021

@sc0ttkclark
See latest comment. This confirms my guess that the remaining error isn't i18n related but a Pods 2.8 bug.
Nevermind, that LEFT JOIN is redundant, probably the reason it's removed in 2.8.

@JoryHogeveen
Copy link
Member

JoryHogeveen commented Oct 18, 2021

Allrighty, found the issue. It's indeed your templates, you didn't create any translations while the Pod Templates are translatable.
While I have no idea why it worked in 2.7, in any case, looking at the PRE installation, this shouldn't have worked at all.

@sc0ttkclark sc0ttkclark modified the milestones: Pods 2.8, Pods 2.8.1 Oct 18, 2021
@carlosrovira
Copy link
Author

Hi @JoryHogeveen, ok. Will try now to create the templates and report back. Thanks

@carlosrovira
Copy link
Author

Hi @JoryHogeveen and @sc0ttkclark. As Jory said, creating the templates with the same info works all ok. So seem 2.7 has some way to make this work without it. Anyway a migration from 2.7 to 2.8 will require to know this fact, so would be good to put it in notes or something to avoid people get stuck with this issue.

Thanks for getting this finaly done. I'll close this issue if you're ok with it.
I think in my case I don't see any problem now with 2.8 version and I'm ready to upgrade production sites.

Thanks

@JoryHogeveen
Copy link
Member

So seem 2.7 has some way to make this work without it.

I honestly think this worked in 2.7 because the compatibility code was outdated and didn't work properly.
2.8 corrected this, fixing any SQL errors but also fixing this bug in the process.

Topic can indeed be closed, thank you for reporting!

@JoryHogeveen JoryHogeveen removed the Status: In Progress Issue or PR is currently in progress but not yet done label Oct 18, 2021
@carlosrovira
Copy link
Author

Hi @JoryHogeveen,

I notice that now, templates show in EN and not in ES. I tried various approaches, but what I found is that If I create add template for a language it doesn't show in the other one and viceversa. I couldn't find a solution for this and decided to post here... do you have any idea of what could be the problem?

@carlosrovira carlosrovira reopened this Oct 18, 2021
@carlosrovira
Copy link
Author

(reopening since I can't post without do so)

Hi @JoryHogeveen,

I notice that now, templates show in EN and not in ES. I tried various approaches, but what I found is that If I create add template for a language it doesn't show in the other one and viceversa. I couldn't find a solution for this and decided to post here... do you have any idea of what could be the problem?

@carlosrovira
Copy link
Author

Hi, I think I finally get it to work with a combination of making the templates not to be a duplicate and clearing pods cache. But was tricky.

While presite is now working, when I cleared the pods cache I got again the following error stack trace:

Notice: Trying to access array offset on value of type bool in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 413

Warning: Invalid argument supplied for foreach() in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 413

Notice: Trying to access array offset on value of type bool in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 413

Warning: Invalid argument supplied for foreach() in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 413

Notice: Trying to access array offset on value of type bool in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 413

Warning: Invalid argument supplied for foreach() in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/pods/components/I18n/I18n.php on line 413

this is using rc3 and 2.8.0 final release update just few minutes ago.

HTH

Carlos

@carlosrovira
Copy link
Author

I got pro site update to 2.8 final release. Just notice that is a bit tricky since you need to clear pods cache and also other caches you can have in your site and refresh it and try again until things settle. Closing again.

@carlosrovira
Copy link
Author

also the error stack trace doesn't show in pro site :?

@JoryHogeveen
Copy link
Member

@carlosrovira

also the error stack trace doesn't show in pro site :?

This is probably because debug is disabled on the production website.

About the errors, could you share the full stack trace and not just the error (warning) itself?

@carlosrovira
Copy link
Author

Hi @JoryHogeveen, ok, please let me know where I can find the full stack trace so I can share here. Thanks

@carlosrovira
Copy link
Author

@JoryHogeveen remember you hace access to the pre site where you can see that error. Also ensure you put in EN view (since only happens in EN, not in ES).

@JoryHogeveen
Copy link
Member

@carlosrovira
If you go to the file with the error you can add var_dump(debug_backtrace()); at that line.
Alternatively you could lookup the error in the server logs.

Unfortunately a WordPress admin login is of no use to me for such errors since I cannot view or modify the code from there.

@carlosrovira
Copy link
Author

Hi @JoryHogeveen, I'll send you server log to your email, since I don't know where I can put the var_dump code you mention.
HTH

@JoryHogeveen
Copy link
Member

Hello @carlosrovira
The server logs don't really hold any extra info and I can't reproduce these errors so I'm not sure how to proceed..

@JoryHogeveen
Copy link
Member

Just got another error that is server related it seems:

Fatal error: Uncaught Error: Call to undefined function simplexml_load_file() in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/includes/class-wp-installer.php:898
Stack trace:
#0 /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/includes/class-wp-installer.php(99): WP_Installer->load_repositories_list()
#1 /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/includes/class-wp-installer.php(80): WP_Installer->__construct()
#2 /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/includes/functions-core.php(6): WP_Installer::instance()
#3 /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/installer.php(15): WP_Installer()
#4 /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/loader.php(184): include_once('...')
#5 /home/codeoscopic/var/www/codeoscopic.com/wp-includes/class-wp-hook.php(303): wpml_installer_instance_delegator()
#6 /home/codeoscopic/var/www/codeoscopic.com/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()
#7 /home/codeoscopic/var/www/codeoscopic.com/wp-includes/plugin.php(470): WP_Hook->do_action()
#8 /home/codeoscopic/var/www/codeoscopic.com/wp-settings.php(556): do_action()
#9 /home/codeoscopic/var/www/codeoscopic.com/wp-config.php(120): require_once('...')
#10 /home/codeoscopic/var/www/codeoscopic.com/wp-load.php(50): require_once('...')
#11 /home/codeoscopic/var/www/codeoscopic.com/wp-admin/admin.php(34): require_once('...')
#12 /home/codeoscopic/var/www/codeoscopic.com/wp-admin/index.php(10): require_once('...')
#13 {main} thrown in /home/codeoscopic/var/www/codeoscopic.com/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/includes/class-wp-installer.php on line 898

@carlosrovira
Copy link
Author

Hi,
I solved some weeks ago and issue with simplexml problem related to WPML [1] and Php 7
Today I upgraded the server (some hours ago) and have to switch to php 8. Maybe that's the issue?. I don't see the simplexml problem again. The issue with it was the site unable to run at all.

[1] https://wpml.org/errata/php-7-possible-issues-simplexml/

@wildmercury
Copy link

I have a very similar issue (same variance across languages, same SELECT DISTINT LEFTJOIN type of query) on a prod site after latest update of Pods. All I can add is that I get a 500 error on the front end and this in the error log:

Request for [REDACTED]/public_html exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: [REDACTED]/wp-admin/post.php?post=4555&action=edit&lang=fr

Hosted on SiteGround with PHP 7.4.25.

@carlosrovira
Copy link
Author

Hi @wildmercury, is your site using WPML? This problem was about using WPML but was fixed. IMHO, an error 500 indicates something different that seems not related to this problem. Did you try to enable debug to see more traces on screen. Usually that use to help to determine what's happening behind.

Also, when migrating to 2.8 I found that some of my pods config was missing configuration checks that now need to be check in order to work.

HTH

C.

@wildmercury
Copy link

wildmercury commented Nov 15, 2021

Thanks for that. Yes, WPML and errors only on one language and with a PHP v8.0 test we get the following error:
Fatal error: Uncaught ValueError: Missing format specifier at end of string in /home/customer/www/[REDACTED]/public_html/wp-content/plugins/pods/classes/PodsInit.php:2034 Stack trace: #0 /home/customer/www/[REDACTED]/public_html/wp-content/plugins/pods/classes/PodsInit.php(2034): sprintf('Nouveau %', 'Pod Template') #1 /home/customer/www/[REDACTED]/public_html/wp-content/plugins/pods/components/Templates/Templates.php(99): PodsInit::object_label_fix(Array, 'post_type') #2 /home/customer/www/[REDACTED]/public_html/wp-content/plugins/pods/classes/PodsComponent.php(17): Pods_Templates->init() #3 /home/customer/www/[REDACTED]/public_html/wp-content/plugins/pods/classes/PodsComponents.php(303): PodsComponent->__construct() #4 /home/customer/www/[REDACTED]/public_html/wp-includes/class-wp-hook.php(303): PodsComponents->load('') #5 /home/customer/www/[REDACTED]/public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(Array, Array) #6 /home/customer/www/[REDACTED]/public_html/wp-includes/plugin.php(470): WP_Hook->do_action(Array) #7 /home/customer/www/[REDACTED]/public_html/wp-settings.php(510): do_action('setup_theme') #8 /home/customer/www/[REDACTED]/public_html/wp-config.php(99): require_once('/home/customer/...') #9 /home/customer/www/[REDACTED]/public_html/wp-load.php(50): require_once('/home/customer/...') #10 /home/customer/www/[REDACTED]/public_html/wp-blog-header.php(13): require_once('/home/customer/...') #11 /home/customer/www/[REDACTED]/public_html/index.php(17): require('/home/customer/...') #12 {main} thrown in /home/customer/www/[REDACTED]/public_html/wp-content/plugins/pods/classes/PodsInit.php on line 2034

Which looks like a string is not being handled properly / has a character missing / or adding a space at the end?

I'm not sure what you mean by "configuration checks that now need to be check in order to work". How would one check a pods config? Nothing has changed in several years (since 2017 I think).

@wildmercury
Copy link

Follow up on this: I did a manual update of String Translations for Pods FR fields namely:
'New %s' is translated to 'Nouveau %' corrected to 'Nouveau %s'
'View %s' is translated to 'Voir %' corrected to 'Voir %s'
That removed the Uncaught ValueError. Who should I direct the request for a more permanent correction there? Pods of WPML?

Still stuck with the original SELECT error...

@carlosrovira
Copy link
Author

I'm not sure what you mean by "configuration checks that now need to be check in order to work". How would one check a pods config? Nothing has changed in several years (since 2017 I think).

I mean that I need to select a couple of checks that was unchecked in 2.7, but was needed in 2.8 in "selected mode" (with the tick) after this major refactor. So 2.7 seems to be less strict in the need

If after try to revise checks and pod config and sabe the problem is not solved, I think you should log a new issue that tries to describe the problem as something new since to me it appears something different to what is described in the original purpose of this issue.

@JoryHogeveen
Copy link
Member

@wildmercury

Follow up on this: I did a manual update of String Translations for Pods FR fields namely:
'New %s' is translated to 'Nouveau %' corrected to 'Nouveau %s'
'View %s' is translated to 'Voir %' corrected to 'Voir %s'
That removed the Uncaught ValueError. Who should I direct the request for a more permanent correction there? Pods of WPML?

I cannot find this translation within the Pods FR translation files: https://translate.wordpress.org/locale/fr/default/wp-plugins/pods/
Where was this added?

If after try to revise checks and pod config and sabe the problem is not solved, I think you should log a new issue that tries to describe the problem as something new since to me it appears something different to what is described in the original purpose of this issue.

Indeed, your issues sounds unrelated to this one, please create a new bug report and provide all info asked so we can reproduce and fix it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants