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

Fatal error when php_uname() is disabled for security reasons. #115

Closed
iamdharmesh opened this issue May 31, 2023 · 6 comments
Closed

Fatal error when php_uname() is disabled for security reasons. #115

iamdharmesh opened this issue May 31, 2023 · 6 comments

Comments

@iamdharmesh
Copy link

Describe the bug
There are many web hosting providers that disable a number of built-in PHP functions due to security reasons. When the php_uname() function is disabled on a web host SDK throws the fatal error.

PHP Fatal error:  Uncaught Error: Call to undefined function Core\Utils\php_uname() in /Users/**/**/**/**/public/wp-content/plugins/woocommerce-square/vendor/apimatic/core/src/Utils/CoreHelper.php:159
Stack trace:
#0 /Users/**/**/**/**/public/wp-content/plugins/woocommerce-square/vendor/apimatic/core/src/ClientBuilder.php(181): Core\Utils\CoreHelper::getOsInfo()
#1 /Users/**/**/**/**/public/wp-content/plugins/woocommerce-square/vendor/apimatic/core/src/ClientBuilder.php(195): Core\ClientBuilder->addUserAgentToGlobalHeaders()
#2 /Users/**/**/**/**/public/wp-content/plugins/woocommerce-square/vendor/square/square/src/SquareClient.php(172): Core\ClientBuilder->build()
#3 /Users/**/**/**/**/public/wp-content/plugins/woocommerce-square/includes/API.php(71): Square\SquareClient->__construct(Array)
#4 /Users/**/**/**/**/public/wp-content/plugins/woocommerce-square/includes/Plugin.php(704): WooCommerce\Square\API->__construct('**', true)
#5 /Users/**/**/**/**/public/wp-content/plugins/woocommerce-square/includes/Settings.php(782): WooCommerce\Square\Plugin->get_api('**', true)
#6 /Users/**/**/**/**/public/wp-content/plugins/woocommerce-square/includes/Settings.php(368): WooCommerce\Square\Settings->get_locations()
#7 /Users/**/**/**/**/public/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php(87): WooCommerce\Square\Settings->get_form_fields()
#8 /Users/**/**/**/**/public/wp-content/plugins/woocommerce-square/includes/Admin/Settings_Page.php(86): WC_Settings_API->admin_options()
#9 /Users/**/**/**/**/public/wp-content/plugins/woocommerce-square/includes/Admin/Settings_Page.php(74): WooCommerce\Square\Admin\Settings_Page->output_general_section()
#10 /Users/**/**/**/**/public/wp-includes/class-wp-hook.php(308): WooCommerce\Square\Admin\Settings_Page->output('')
#11 /Users/**/**/**/**/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#12 /Users/**/**/**/**/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#13 /Users/**/**/**/**/public/wp-content/plugins/woocommerce/includes/admin/views/html-admin-settings.php(40): do_action('woocommerce_set...')
#14 /Users/**/**/**/**/public/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php(153): include('***')
#15 /Users/**/**/**/**/public/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-menus.php(291): WC_Admin_Settings::output()
#16 /Users/**/**/**/**/public/wp-includes/class-wp-hook.php(308): WC_Admin_Menus->settings_page('')
#17 /Users/**/**/**/**/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#18 /Users/**/**/**/**/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#19 /Users/**/**/**/**/public/wp-admin/admin.php(259): do_action('woocommerce_pag...')
#20 {main}
  thrown in /Users/**/**/**/**/public/wp-content/plugins/woocommerce-square/vendor/apimatic/core/src/Utils/CoreHelper.php on line 159

Expected behavior
Square SDK should work fine without any fatal error if php_uname is disabled.

To Reproduce
Steps to reproduce the bug:

  1. Set up an environment with php_uname disabled.
  2. Try to initiate SquareClient. You will get the fatal error.

Screenshots
If applicable, add screenshots to help explain the bug.

Square SDK version
24.0.0.20221116

Additional context
Add any other context about the problem here.

@iamdharmesh
Copy link
Author

@jessdelacruzsantos This issue has been addressed and resolved in the recent release of apimatic/core. Maybe the best time to fix it here by updating the dependency version here in square SDK?

@zenmasterjobo
Copy link
Contributor

hi @iamdharmesh

These changes should be brought in and reflect in our July release. Currently we scheduling for that to go live July 6th.

Thanks again for your contributions in highlighting this issue!

@Sidsector9
Copy link

@zenmasterjobo is there any update on the release?

@zenmasterjobo
Copy link
Contributor

hi @Sidsector9 and @iamdharmesh

Version 29.0.0.20230720 incorporates APIMatic's core change Please check it out and let me know if your problem is still persisting!

@Sidsector9
Copy link

Thanks @zenmasterjobo , I just confirmed that the issue is no longer present.

@zenmasterjobo
Copy link
Contributor

@Sidsector9 Excellent! Thanks again for reporting the issue!

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

No branches or pull requests

3 participants