Skip to content

Commit

Permalink
Address default php.ini setting for php 7.4+
Browse files Browse the repository at this point in the history
As of PHP 7.4, zend.exception_ignore_args was created and set to 'true'.
This has meant that a feature of SBA is not supported, specifically relating
to the stock of attributed product. This modification checks to see if
that setting is present, if it is present then it attempts to modify the
setting to be 'false', then to return it to its former value.

Fixes #95 at least allows continued operation of the same method of determination.
  • Loading branch information
mc12345678 committed Jan 31, 2021
1 parent 0f82550 commit 9884e3d
Showing 1 changed file with 10 additions and 0 deletions.
Expand Up @@ -120,7 +120,17 @@ function updateZenGetProductsStock(&$callingClass, $notifier, $products_id, &$pr
// Check if SBA tracked, if not, then no need to process further.
if (!$_SESSION['pwas_class2']->zen_product_is_sba($products_id)) return false;

// Try to get the current setting of this value that defaults to true in PHP 7.4+
$exception_ignore = ini_get('zend.exception_ignore_args');

if ($exception_ignore !== false && $exception_ignore !== 'false') {

This comment has been minimized.

Copy link
@mc12345678

mc12345678 Feb 1, 2021

Author Owner

Upon even further review, because zend.exception_ignore_args is a boolean this should not explicitly check for false but instead loosely check for 0 or empty text... This is because presumably ini_get will return values such as false, off, 0, etc... as either a text '0' or '', both of which evaluate to true within the use of empty().

Likely best to use:

-     if ($exception_ignore !== false && $exception_ignore !== 'false') {
+     if ($exception_ignore !== false && !empty($exception_ignore)) {
$ignore_old = ini_set('zend.exception_ignore_args', 'false');
}
$backtrace = debug_backtrace();
if (isset($ignore_old)) {
ini_set('zend.exception_ignore_args', $ignore_old);
}

$current_level = -1;
$args = array();
$attributes = array();
Expand Down

0 comments on commit 9884e3d

Please sign in to comment.