pmcelwee
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce PayPal Payments] CRITICAL Uncaught Error Class not foundI am getting this error as well, but very intermittently. It attaches to a specific user and will error out every time they try to load a page while logged in.
This is going to be a hard problem to reproduce because it is so intermittent. I’m not sure the dev team is going to be able to wait for a website with a clear-cut, reproducible case.
But I can tell you an apparent workaround: as an admin user, “View As” the user who is having the issue.
From walking through the stack trace, it looks like there is a bad “order” attached to the user’s session. This bad “order” lacks a name. By invoking “View As”, my theory is that this bad session data is flushed.
I don’t know how the bad order is created. If we could figure that out, it might point toward a reproducible case. Perhaps an aborted PayPal order?
Is there a better issue tracker to which I could contributor? I’m a developer and would be happy to try to help track this down.
Forum: Plugins
In reply to: [WooCommerce PayPal Payments] Fatar ErrorI had the same issue. It was with a customer who apparently had an order attached to them (their session?) that had a
PaymentSource
with a blankname
. All attempts to load any page while they were logged in generated the error.I was able to fix it for this customer by temporarily rewriting the
name()
function inwoocommerce-paypal-payments/modules/ppcp-api-client/src/Entity/PaymentSource.php
to$result = $this->name ?? "unknown";
return $result;
After loading pages while logged in as this customer, I then reverted my code and the error went away. Perhaps it flushed the session somehow?
Forum: Plugins
In reply to: [WooCommerce PayPal Payments] Paypal ErrorI had the same issue. It was with a customer who apparently had an order attached to them (their session?) that had a
PaymentSource
with a blankname
. All attempts to load any page while they were logged in generated the error.I was able to fix it for this customer by temporarily rewriting the
name()
function inwoocommerce-paypal-payments/modules/ppcp-api-client/src/Entity/PaymentSource.php
to$result = $this->name ?? "unknown";
return $result;
After loading pages while logged in as this customer, I then reverted my code and the error went away. Perhaps it flushed the session somehow?
OK, after quite a bit of digging, I found a cause and a workaround: disabling the “BuddyPress” module in Rank Math makes the errors go away. … So perhaps there has been an update to BuddyBoss Platform or Theme that caused this to stop working correctly? I recently upgraded to BuddyBoss’s most recent Platform and Theme version, 2.0.7.
I discovered that the error is generated when opening BuddyBoss member pages, or list pages that are nested under a member page, ie that start with “/members/{some-member}”
For example, it occurs on https://sewliberated.com/members/patrick/ (which you have to be logged in to see. I’d be happy to set you up with an account for testing, perhaps on my staging server.)
In the Apache log, it appeared to come from random pages (listed as a “referrer”) because certain logged-in user actions cause such messages to be pre-fetched.
When I visit a member page directly, I still get an error message, but without the “referrer” information:
[Tue Aug 09 15:42:25.043764 2022] [proxy_fcgi:error] [pid 29805:tid 140022929725184] [client 99.46.154.61:52912] AH01071: Got error ‘PHP message: PHP Warning: Undefined array key “@id” in /home/673753.cloudwaysapps.com/yvrqnvayfz/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/schema/class-frontend.php on line 243’
Looking through the source code of a member page for schema, I only find an Organization schema (no Person):
<script type="application/ld+json" class="rank-math-schema">{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://sewliberated.com/#organization","name":"Sew Liberated","logo":{"@type":"ImageObject","@id":"https://sewliberated.com/#logo","url":"https://sewliberated-1b3ad.kxcdn.com/wp-content/uploads/2021/12/sewliberated-logo-one-color-rgb-160x109-1.png","caption":"Sew Liberated","inLanguage":"en-US","width":"160","height":"109"}},{"@type":"WebSite","@id":"https://sewliberated.com/#website","url":"https://sewliberated.com","name":"Sew Liberated","publisher":{"@id":"https://sewliberated.com/#organization"},"inLanguage":"en-US"},{"@type":"WebPage","@id":"#webpage","url":"","datePublished":"","dateModified":"","isPartOf":{"@id":"https://sewliberated.com/#website"},"inLanguage":"en-US"}]}</script>
When the BuddyPress module is enabled, the error also occurs on all the nested pages I have tested. For example, on specific message pages ( https://sewliberated.com/members/patrick/messages/view/3/ ) and on BuddyBoss group listing pages (https://sewliberated.com/members/patrick/groups/) . In these cases, the schema on the page is the same, just Organization.
Thanks, but after poking around, I don’t think this has to do with the product schema or archives pages. (I see the error on pages and BuddyBoss pages. The former have the Article schema and the second shouldn’t have schema as far as I know. And in any case, it doesn’t seem to be modifiable by me.
Instead, I think this is probably a bug introduced by upgrading to PHP8.0. (The OP was also using PHP8.) Here is the relevant code from the Frontend class, with a couple comments from me:
/** * Remove Person entity if it is not referenced in any other entities. * * @param array $data Array of json-ld data. * * @return array */ public function remove_person_entity( $data ) { if ( empty( $data['ProfilePage'] ) || ! is_singular() ) { /* SEEMS THAT THIS IF CLAUSE IS not working as intended */ return $data; } $temp_data = $data; $id = $temp_data['ProfilePage']['@id']; /* THIS IS THE LINE THAT ERRORS */ $ids = [];
I am having the same issue with the same error message, not just for individual pages, but for whole categories of pages (Woocommerce orders, BuddyBoss members, BuddyBoss groups). I tried editing everything on the SEO Settings page, but was not able to resolve it.
All my plugins are fully up-to-date, and I have the bbPress module turned on.
I also tried looking for wp_postmeta entries, but turned up no rows with this query:
select * from wp_postmeta WHERE meta_key LIKE 'rank_math_schema%' LIMIT 100
Thanks for your help.
The problem is that the import didn’t add meta_data to the order with the key _order_key. (It *did* correctly add an order key to the order itself.)
For others who may come across this, I was able to fix it with this SQL statement, which fixed over 59,000 orders in about 33 seconds (the
post_password
column is where Woocommerce stores the order_key):
INSERT INTOwp_postmeta
(post_id
,meta_key
,meta_value
)
SELECT
wp_posts
.ID,
'_order_key',
wp_posts
.post_password
FROMwp_posts
WHEREpost_type
= 'shop_order'
AND NOT EXISTS(
SELECT 1
FROMwp_postmeta
WHEREpost_id
=wp_posts
.ID ANDmeta_key
= '_order_key'
)Thanks for looking into it, though while I’m glad it will be fixed for other users, to be honest, an update won’t solve my issue, since my import is complete. Any clues on how to fix it now would be much appreciated!