bbceg
Forum Replies Created
-
No worries @omarfpg thanks for trying again. Closing it seems the sensible option for now – not least because it’s in the wrong forum, I completely missed that too!
Hi @omarfpg ,
Sorry you’ve had to chase. I recently upgraded my PHP version to 8.2 hoping this would fix the problem but there has been no change. I am using the old cart rather than the block-based version in @shameemreza ‘s demo which might explain why he didn’t see an error but I’d still expect errors in the logs when updating via the admin or elsewhere.
I’m not sure what else to suggest. I’m only really raising it in case something needs to be fixed before a PHP update completely drops support for a null second parameter in preg_match.
However if you can’t replicate I guess there’s not much that can be done and it makes sense to close the issue…
Thanks for looking @shameemreza . Did you have WP_DEBUG enabled when you did those tests?
Hi @omarfpg
Thanks for investigating. Please can you try disabling Ajax add to cart to to see if that makes a difference?
Hi @carolm29,
Thanks for this. The error is in my logs.
Here are the screenshots requested:
- Shipping: https://snipboard.io/i5YnOa.jpg
- Zone: https://snipboard.io/ikfZwU.jpg
- Rate: https://snipboard.io/ykDmVu.jpg
- Error (with Ajax add to cart buttons disabled): https://snipboard.io/ThSdAa.jpg
Error in logs (with Ajax add to cart buttons enabled):
2024/07/05 17:18:02 [error] 17350#17350: *94 FastCGI sent in stderr: "PHP message: PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /c/Solutions/wordpress/wp-content/plugins/woocommerce/includes/libraries/class-wc-eval-math.php on line 162" while reading response header from upstream, client: 192.168.1.50, server: wordpress.localdev, request: "POST /?wc-ajax=add_to_cart HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "wordpress.localdev", referrer: "http://wordpress.localdev/shop/"And the system report:
WordPress Environment
WordPress address (URL): http://wordpress.localdev
Site address (URL): http://wordpress.localdev
WC Version: 9.0.2
Legacy REST API Package Version: The Legacy REST API plugin is not installed on this site.
Action Scheduler Version: ✔ 3.7.4
Log Directory Writable: ✔
WP Version: 6.5.5
WP Multisite: –
WP Memory Limit: 512 MB
WP Debug Mode: ✔
WP Cron: ✔
Language: en_GB
External object cache: – Server Environment
Server Info: nginx/1.22.1
PHP Version: 8.1.29
PHP Post Max Size: 8 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.81.0
OpenSSL/3.0.2
SUHOSIN Installed: –
MySQL Version: 8.0.37-0ubuntu0.22.04.3
Max Upload Size: 2 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔ Database
WC Database Version: 9.0.2
WC Database Prefix: wp_
Total Database Size: 5.23MB
Database Data Size: 3.37MB
Database Index Size: 1.86MB
wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_actions: Data: 0.02MB + Index: 0.16MB + Engine InnoDB
wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_affiliatemeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_affiliates: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_campaigns: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_coupons: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_creatives: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_customermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_customers: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_notifications: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_payouts: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_referralmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_affiliate_wp_referrals: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_rest_consumers: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_sales: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_affiliate_wp_visits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_options: Data: 2.03MB + Index: 0.06MB + Engine InnoDB
wp_postmeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
wp_posts: Data: 0.05MB + Index: 0.06MB + Engine InnoDB
wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_admin_note_actions: Data: 0.06MB + Index: 0.02MB + Engine InnoDB
wp_wc_admin_notes: Data: 0.08MB + Index: 0.00MB + Engine InnoDB
wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB Post Type Counts
attachment: 1
page: 10
post: 2
product: 2
revision: 5
shop_order: 5 Security
Secure connection (HTTPS): ❌
Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
Hide errors from visitors: ❌Error messages should not be shown to visitors. Active Plugins (1)
WooCommerce: by Automattic – 9.0.2 Inactive Plugins (2)
AffiliateWP: by AffiliateWP – 2.9.6.1
AffiliateWP - Affiliate Portal: by Sandhills Development
LLC – 1.1.3
Classic Editor: by WordPress Contributors – 1.6.3
WooCommerce Stripe Gateway: by WooCommerce – 8.4.0
API Enabled: –
Force SSL: –
Currency: GBP (£)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)
Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)
Connected to WooCommerce.com: –
Enforce Approved Product Download Directories: –
HPOS feature enabled: –
Order datastore: WC_Order_Data_Store_CPT
HPOS data sync enabled: – Logging
Enabled: ✔
Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2
Retention period: 30 days
Level threshold: –
Log directory size: 5 KB WC Pages
Shop base: #14 - /shop/
Basket: #15 - /basket/
Checkout: #16 - /checkout/
My account: #17 - /my-account/
Terms and conditions: ❌ Page not set Theme
Name: Storefront
Version: 4.6.0
Author URL: https://woocommerce.com/
Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build
personally we recommend using a child theme. See: How to create a child theme
WooCommerce Support: ✔ Templates
Overrides: – Admin
Enabled Features: activity-panels
analytics
product-block-editor
coupons
core-profiler
customize-store
customer-effort-score-tracks
import-products-task
experimental-fashion-sample-products
shipping-smart-defaults
shipping-setting-tour
homescreen
marketing
mobile-app-banner
navigation
onboarding
onboarding-tasks
product-custom-fields
remote-inbox-notifications
remote-free-extensions
payment-gateway-suggestions
shipping-label-banner
subscriptions
store-alerts
transient-notices
woo-mobile-welcome
wc-pay-promotion
wc-pay-welcome-page
Disabled Features: minified-js
new-product-management-experience
pattern-toolkit-full-composability
product-pre-publish-modal
settings
async-product-editor-category-field
launch-your-store
product-editor-template-system
Daily Cron: ✔ Next scheduled: 2024-07-05 17:09:15 +01:00
Options: ✔
Notes: 123
Onboarding: skipped Action Scheduler
Complete: 18
Oldest: 2024-07-04 16:11:46 +0100
Newest: 2024-07-05 17:16:23 +0100
Failed: 8
Oldest: 2023-03-07 12:07:23 +0000
Newest: 2024-07-04 17:13:27 +0100
Pending: 1
Oldest: 2024-07-06 16:13:38 +0100
Newest: 2024-07-06 16:13:38 +0100 Status report information
Generated at: 2024-07-05 17:30:48 +01:00
`Forum: Plugins
In reply to: [WooCommerce] Deprecated: preg_match()Forum: Plugins
In reply to: [WooCommerce] Deprecated: preg_match()Hi @anastas10s
I’ve started seeing this error too. In my case it seems to relate to shipping calculations. As soon as I add parentheses in the shipping method cost it throws the error. If I remove them and save it does not.
Does not break:
8 * [qty]Breaks:
( 8 * [qty] )Also breaks:
4 + ( 8 * [qty] )I’m currently running PHP 8.1.29 with Woocommerce 9.0.2 but rolling back to Woocommerce 8.7.1 (and others) doesn’t change the situation. This is with the Storefront theme and no other plugins.
Hope you can help.
Thank you. In the end I decided to revert to the more typical flat structure but will look out for the Pop-less refactor in case that sorts it.
Hi @imagely ,
Many thanks for the swift response. When you say a ‘hard link’ will work, please can you give an example? I am in full control of the server so there are no restrictions.
Hi @budimirdq
The decision was made to stick to one account for now so I didn’t get any further. That includes not reaching out to the developers on Slack so you might want to give that a try.
I’d be very interested to hear how you get on as multiple accounts would still be a better fit for my project.
Thanks @ihereira
As alluded to above, I am already successfully submitting payments to multiple stripe accounts, my current issue is that I cannot set the webhook secret and I don’t believe there is provision for this via the existing hooks/filters.
Nevertheless, I will try the developers in Slack as that’s probably a more appropriate place for this discussion.
Thanks for the swift response. I’ve done quite a lot of digging through the code and various hooks already and wonder if it might need a new hook. I’ll try the other channels and see if that might be possible.
Sure, if that suits you best. I’ve just seen your urgent help link, I’ll drop you an email.
I’m thinking I might need a filter wherever $default_location appears and then I can return the customer’s chosen location. Do you think that might be possible?
In the checkout I’m currently doing the following for the order:
function update_order_item_meta_with_stock_location( $item, $cart_item_key, $values, $order ) { // TODO: Get location from cookie $item->update_meta_data( '_stock_location', 45 ); } add_action('woocommerce_checkout_create_order_line_item', 'update_order_item_meta_with_stock_location', 10, 4);But I still need to sort the basket and the product page (including checking quantities etc.).
Hope you can help.
Thanks @fahadmahmood
That might inadvertently do what I need though it’s not working at present. Rather than setting the default location I need to be able to set the user’s chosen location instead. What’s the best way to go about that? At the moment it is not preventing the user from adding a larger quantity of a product than is available.