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

Deprecation warnings while running PHPunit tests #2403

Open
joeparsons opened this issue May 12, 2023 · 5 comments
Open

Deprecation warnings while running PHPunit tests #2403

joeparsons opened this issue May 12, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@joeparsons
Copy link
Member

Problem/Motivation

Deprecation warnings are generated when running our Quickstart PHPunit tests.

Describe the bug

Deprecated: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /app/web/core/lib/Drupal/Core/Config/Entity/Query/Condition.php on line 39

Deprecated: Return type of GuzzleHttp\Cookie\CookieJar::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php on line 220

Deprecated: Return type of GuzzleHttp\Cookie\CookieJar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php on line 225

To Reproduce

lando phpunit

Proposed resolution

Find (and fix) the source of the deprecation warnings.

@joeparsons joeparsons added the bug Something isn't working label May 12, 2023
@joeparsons joeparsons self-assigned this May 12, 2023
@joeparsons
Copy link
Member Author

Backtrace for first deprecation warning:
Deprecated: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /app/web/core/lib/Drupal/Core/Config/Entity/Query/Condition.php on line 39

#0 /app/web/core/lib/Drupal/Core/Config/Entity/Query/Query.php(85): Drupal\Core\Config\Entity\Query\Condition->compile(Array)
#1 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(302): Drupal\Core\Config\Entity\Query\Query->execute()
#2 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(562): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage))
#3 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(517): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\Core\Datetime\Entity\DateFormat))
#4 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(253): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\Core\Datetime\Entity\DateFormat))
#5 /app/web/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\Core\Datetime\Entity\DateFormat))
#6 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(608): Drupal\Core\Entity\EntityBase->save()
#7 /app/web/core/lib/Drupal/Core/Config/ConfigInstaller.php(392): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#8 /app/web/core/lib/Drupal/Core/Config/ConfigInstaller.php(152): Drupal\Core\Config\ConfigInstaller->createConfiguration('', Array)
#9 /app/web/core/lib/Drupal/Core/ProxyClass/Config/ConfigInstaller.php(75): Drupal\Core\Config\ConfigInstaller->installDefaultConfig('module', 'system')
#10 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(327): Drupal\Core\ProxyClass\Config\ConfigInstaller->installDefaultConfig('module', 'system')
#11 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, false)
#12 /app/web/core/includes/install.inc(642): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, false)
#13 /app/web/core/includes/install.core.inc(1098): drupal_install_system(Array)
#14 /app/web/core/includes/install.core.inc(700): install_base_system(Array)
#15 /app/web/core/includes/install.core.inc(571): install_run_task(Array, Array)
#16 /app/web/core/includes/install.core.inc(119): install_run_tasks(Array, NULL)
#17 /app/web/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php(299): install_drupal(Object(Composer\Autoload\ClassLoader), Array)
#18 /app/web/core/tests/Drupal/Tests/BrowserTestBase.php(542): Drupal\Tests\BrowserTestBase->doInstall()
#19 /app/web/core/tests/Drupal/Tests/BrowserTestBase.php(366): Drupal\Tests\BrowserTestBase->installDrupal()
#20 /usr/local/quickstart-install-profile/modules/custom/az_core/tests/src/Traits/AllowDrupalLoginSetupTrait.php(14): Drupal\Tests\BrowserTestBase->setUp()
#21 /usr/local/quickstart-install-profile/modules/custom/az_cas/tests/src/Functional/AzCasAdminSettingsTest.php(47): Drupal\Tests\az_core\Functional\QuickstartFunctionalTestBase->setUp()
#22 /app/web/sites/simpletest/TestCase.php(1110): Drupal\Tests\az_cas\Functional\AzCasAdminSettingsTest->setUp()
#23 /app/vendor/phpunit/phpunit/src/Framework/TestResult.php(703): PHPUnit\Framework\TestCase->runBare()
#24 /app/web/sites/simpletest/TestCase.php(840): PHPUnit\Framework\TestResult->run(Object(Drupal\Tests\az_cas\Functional\AzCasAdminSettingsTest))
#25 Standard input code(58): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#26 Standard input code(112): __phpunit_run_isolated_test()

@joeparsons
Copy link
Member Author

joeparsons commented May 12, 2023

Backtrace from query condition with empty value:

FWIW. the same Drupal\field\EntityDisplayRebuilder->rebuildEntityTypeDisplays() method is being called for az_person, az_event, az_flexible_page, and az_news and each one seems to generate the deprecation warning.

#0 /app/web/core/lib/Drupal/Core/Config/Entity/Query/Query.php(85): Drupal\Core\Config\Entity\Query\Condition->compile(Array)
#1 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(302): Drupal\Core\Config\Entity\Query\Query->execute()
#2 /app/web/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(262): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage))
#3 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(562): Drupal\Core\Entity\EntityDisplayBase->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage))
#4 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(517): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\Core\Entity\Entity\EntityFormDisplay))
#5 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(253): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\Core\Entity\Entity\EntityFormDisplay))
#6 /app/web/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\Core\Entity\Entity\EntityFormDisplay))
#7 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(608): Drupal\Core\Entity\EntityBase->save()
#8 /app/web/core/modules/field/src/EntityDisplayRebuilder.php(93): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#9 /app/web/core/modules/field/field.module(352): Drupal\field\EntityDisplayRebuilder->rebuildEntityTypeDisplays('node', 'az_person')
#10 [internal function]: field_field_config_insert(Object(Drupal\field\Entity\FieldConfig))
#11 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(426): call_user_func_array(Object(Closure), Array)
#12 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'field')
#13 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(433): Drupal\Core\Extension\ModuleHandler->invokeAllWith('field_config_in...', Object(Closure))
#14 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(337): Drupal\Core\Extension\ModuleHandler->invokeAll('field_config_in...', Array)
#15 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(598): Drupal\Core\Config\Entity\ConfigEntityStorage->invokeHook('insert', Object(Drupal\field\Entity\FieldConfig))
#16 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(523): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\field\Entity\FieldConfig), false)
#17 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(253): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\field\Entity\FieldConfig))
#18 /app/web/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\field\Entity\FieldConfig))
#19 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(608): Drupal\Core\Entity\EntityBase->save()
#20 /app/web/core/lib/Drupal/Core/Config/ConfigInstaller.php(392): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#21 /app/web/core/lib/Drupal/Core/Config/ConfigInstaller.php(263): Drupal\Core\Config\ConfigInstaller->createConfiguration('', Array, true)
#22 /app/web/modules/contrib/config_provider/src/ProxyClass/ConfigProviderConfigInstaller.php(84): Drupal\Core\Config\ConfigInstaller->installOptionalConfig(Object(Drupal\Core\Config\ExtensionInstallStorage), Array)
#23 /app/web/core/includes/install.core.inc(1657): Drupal\config_provider\ProxyClass\ConfigProviderConfigInstaller->installOptionalConfig()
#24 /app/web/core/includes/install.core.inc(700): install_install_profile(Array)
#25 /app/web/core/includes/install.core.inc(571): install_run_task(Array, Array)
#26 /app/web/core/includes/install.core.inc(119): install_run_tasks(Array, NULL)
#27 /app/web/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php(299): install_drupal(Object(Composer\Autoload\ClassLoader), Array)
#28 /app/web/core/tests/Drupal/Tests/BrowserTestBase.php(542): Drupal\Tests\BrowserTestBase->doInstall()
#29 /app/web/core/tests/Drupal/Tests/BrowserTestBase.php(366): Drupal\Tests\BrowserTestBase->installDrupal()
#30 /usr/local/quickstart-install-profile/modules/custom/az_core/tests/src/Functional/QuickstartFunctionalTestBase.php(18): Drupal\Tests\BrowserTestBase->setUp()
#31 /usr/local/quickstart-install-profile/modules/custom/az_cas/tests/src/Functional/AzCasAdminSettingsTest.php(47): Drupal\Tests\az_core\Functional\QuickstartFunctionalTestBase->setUp()
#32 /app/web/sites/simpletest/TestCase.php(1110): Drupal\Tests\az_cas\Functional\AzCasAdminSettingsTest->setUp()
#33 /app/vendor/phpunit/phpunit/src/Framework/TestResult.php(703): PHPUnit\Framework\TestCase->runBare()
#34 /app/web/sites/simpletest/TestCase.php(840): PHPUnit\Framework\TestResult->run(Object(Drupal\Tests\az_cas\Functional\AzCasAdminSettingsTest))
#35 Standard input code(58): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#36 Standard input code(112): __phpunit_run_isolated_test()

@joeparsons
Copy link
Member Author

Saw this after installing the Quickstart Multilingual module on @akslay's PR #2390:

Deprecated function: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Config\Entity\Query\Condition->compile() (line 39 of core/lib/Drupal/Core/Config/Entity/Query/Condition.php).
Drupal\Core\Config\Entity\Query\Condition->compile(Array) (Line: 85)
Drupal\Core\Config\Entity\Query\Query->execute() (Line: 302)
Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object) (Line: 262)
Drupal\Core\Entity\EntityDisplayBase->preSave(Object) (Line: 562)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 517)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 253)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 608)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 312)
language_modules_installed(Array, )
call_user_func_array(Object, Array) (Line: 426)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'language') (Line: 405)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('modules_installed', Object) (Line: 433)
Drupal\Core\Extension\ModuleHandler->invokeAll('modules_installed', Array) (Line: 381)
Drupal\Core\Extension\ModuleInstaller->install(Array, 1) (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array) (Line: 175)
Drupal\system\Form\ModulesListConfirmForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 595)
Drupal\Core\Form\FormBuilder->processForm('system_modules_confirm_form', Array, Object) (Line: 323)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

@joeparsons
Copy link
Member Author

@joeparsons joeparsons moved this to In Progress in 2.8.x Patch Release Issues Oct 5, 2023
@joshuasosa
Copy link
Contributor

I get these deprecated errors when initially installing a new site.

Could try with issue 3302838's MR!4263 (Patch).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: In Progress
Development

No branches or pull requests

3 participants