From 4d102d5e6c06c2d51d6dd1fe9f72741d832c43fb Mon Sep 17 00:00:00 2001 From: Brad Kent Date: Tue, 15 Oct 2024 00:31:18 -0500 Subject: [PATCH] php 7.2 & 7.3 issue with xdebug --- .github/workflows/phpunit.yml | 2 +- src/Debug/Abstraction/Object/Subscriber.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index aa0c560d..a5e74de0 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -36,7 +36,7 @@ jobs: with: php-version: ${{ matrix.php-version }} extensions: intl, mysqli, oauth - ini-values: error_reporting=-1, memory_limit=512M, post_max_size=256M, xdebug.mode="debug,coverage,develop" + ini-values: error_reporting=-1, memory_limit=512M, post_max_size=256M, xdebug.mode="coverage,debug,develop" coverage: xdebug #optional - name: Check PHP Version run: | diff --git a/src/Debug/Abstraction/Object/Subscriber.php b/src/Debug/Abstraction/Object/Subscriber.php index da3a7abe..17227743 100644 --- a/src/Debug/Abstraction/Object/Subscriber.php +++ b/src/Debug/Abstraction/Object/Subscriber.php @@ -227,15 +227,19 @@ private function onStartMysqli(Abstraction $abs) test if stat() throws an error (ie "Property access is not allowed yet") if so, don't collect property values */ - \set_error_handler(static function ($errno, $errstr) { - throw new RuntimeException($errstr, $errno); // @codeCoverageIgnore + $haveError = false; + \set_error_handler(static function ($errno, $errstr) use (&$haveError) { + $haveError = true; }, E_ALL); try { $mysqli = $abs->getSubject(); $mysqli->stat(); } catch (Error $e) { - $abs['collectPropertyValues'] = false; + $haveError = true; } catch (RuntimeException $e) { + $haveError = true; + } + if ($haveError) { $abs['collectPropertyValues'] = false; } \restore_error_handler();