You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When doing the normal Newspack Setup in WP Admin or wp newspack setup, using the latest Newspack Plugin 5.3.9 and the latest Newspack Blocks 4.1.1, a fatal error will be thrown.
PHP Fatal error: Uncaught Error: Call to undefined function is_account_page().
The function is_account_page() is defined within Woocommerce which is not installed/activated yet when the Blocks plugin is attempted to be activated.
To Reproduce
This can be tested by creating a clean wp install, then installing the plugin and blocks:
# create a clean wp install
# activate these 2 plugins from zip release files
wp plugin install --activate ~/releases/newspack-plugin/5.3.9/newspack-plugin.zip
wp plugin install --activate ~/releases/newspack-blocks/4.1.1/newspack-blocks.zip
Newspack Blocks will fail to activate. (Newspack "setup" will also fail since Blocks is activated prior to Woo).
View debug.log:
PHP Fatal error: Uncaught Error: Call to undefined function is_account_page() in plugins\newspack-plugin\includes\reader-revenue\my-account\class-woocommerce-my-account.php:438
Stack trace:
#0 ...plugins\newspack-blocks\includes\class-modal-checkout.php(1078): Newspack\WooCommerce_My_Account::is_from_my_account()
#1 ...plugins\newspack-blocks\includes\class-modal-checkout.php(86): Newspack_Blocks\Modal_Checkout::is_modal_checkout()
#2 ...plugins\newspack-blocks\includes\class-modal-checkout.php(1258): Newspack_Blocks\Modal_Checkout::init()
#3 ...plugins\newspack-blocks\newspack-blocks.php(23)
Expected behavior
Neither Newspack setup nor Newspack Blocks activation should throw error. I would assume checking if function_exists and/or if Woocommerce is installed/active will solve the problem. I'm not sure if is_from_my_account() needs to proactively return true/false based on if Woo is active or not (I would assume return false).
The text was updated successfully, but these errors were encountered:
Describe the bug
When doing the normal Newspack Setup in WP Admin or
wp newspack setup
, using the latest Newspack Plugin 5.3.9 and the latest Newspack Blocks 4.1.1, a fatal error will be thrown.PHP Fatal error: Uncaught Error: Call to undefined function is_account_page()
.Offending code here:
newspack-plugin/includes/reader-revenue/my-account/class-woocommerce-my-account.php
Line 452 in 408936e
Original PR.
The function
is_account_page()
is defined within Woocommerce which is not installed/activated yet when the Blocks plugin is attempted to be activated.To Reproduce
This can be tested by creating a clean wp install, then installing the plugin and blocks:
Newspack Blocks will fail to activate. (Newspack "setup" will also fail since Blocks is activated prior to Woo).
View debug.log:
Expected behavior
Neither Newspack setup nor Newspack Blocks activation should throw error. I would assume checking if
function_exists
and/or if Woocommerce is installed/active will solve the problem. I'm not sure ifis_from_my_account()
needs to proactively return true/false based on if Woo is active or not (I would assumereturn false
).The text was updated successfully, but these errors were encountered: