- Issue created by @bhuvaneshwar
- Assigned to bhuvaneshwar
- Status changed to Postponed: needs info
4 months ago 5:49am 31 July 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Thanks for reporting this! But โฆ it's a mystery to me how to reproduce this, since tests are passing and no backtrace is included.
- ๐ฎ๐ณIndia bhuvaneshwar
So, when I try to uninstall XB, I encounter this error or by going to the uninstall page.
- ๐ฎ๐ณIndia bhuvaneshwar
Here is the stack trace:
TypeError: str_starts_with(): Argument #1 ($haystack) must be of type string, null given in str_starts_with() (line 140 of /var/www/html/modules/experience_builder/src/FieldTypeUninstallValidator.php). #0 /var/www/html/modules/experience_builder/src/FieldTypeUninstallValidator.php(140): str_starts_with() #1 /var/www/html/modules/experience_builder/src/FieldTypeUninstallValidator.php(56): Drupal\experience_builder\FieldTypeUninstallValidator->checkDefaultValueUses() #2 /var/www/html/core/lib/Drupal/Core/Extension/ModuleInstaller.php(645): Drupal\experience_builder\FieldTypeUninstallValidator->validate() #3 /var/www/html/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(99): Drupal\Core\Extension\ModuleInstaller->validateUninstall() #4 /var/www/html/core/modules/system/src/Form/ModulesUninstallForm.php(161): Drupal\Core\ProxyClass\Extension\ModuleInstaller->validateUninstall() #5 [internal function]: Drupal\system\Form\ModulesUninstallForm->buildForm() #6 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array() #7 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(284): Drupal\Core\Form\FormBuilder->retrieveForm() #8 /var/www/html/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm() #9 [internal function]: Drupal\Core\Controller\FormController->getContentResult() #10 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array() #11 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #12 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext() #13 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() #14 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #15 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw() #16 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle() #17 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle() #18 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle() #19 /var/www/html/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle() #20 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle() #21 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass() #22 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle() #23 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() #24 /var/www/html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() #25 /var/www/html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle() #26 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(736): Drupal\Core\StackMiddleware\StackedHttpKernel->handle() #27 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle() #28 {main}
- Status changed to Active
4 months ago 1:35pm 5 August 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Aha! Nice catch! ๐
That's something that we should be able to add explicit test coverage for pretty easily I think? ๐
- Merge request !143Issue #3464830: TypeError: str_starts_with(): Argument #1 ($haystack) must be... โ (Merged) created by bhuvaneshwar
- Issue was unassigned.
- Status changed to Needs work
4 months ago 6:37am 6 August 2024 - First commit to issue fork.
- Assigned to wim leers
- Status changed to Needs review
4 months ago 11:28am 8 August 2024 @wimleers I just added the tests asserting that we are able to load the page which was not happening prior to this fix.Is there something else that needs to be a part of this test?Assigning it to you for the clarifications on this.
- Issue was unassigned.
- Status changed to RTBC
4 months ago 12:02pm 8 August 2024 - Status changed to Needs work
4 months ago 12:06pm 8 August 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
I was wrong:
P.S.: I ran the test-only CI job and it passed tests: https://git.drupalcode.org/project/experience_builder/-/jobs/2379770 โ which means that there was indeed a test failure, which means that this MR contains the appropriate test coverage. ๐
That CI job should've failed. The test passes locally without the code changes.
- Assigned to wim leers
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Found the root cause: the test assertion was inverted โฆ which meant it always passes.
Fixed.
- Issue was unassigned.
- Status changed to RTBC
4 months ago 1:05pm 8 August 2024 - Assigned to utkarsh_33
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
If you agree with my changes, then the honor is all yours to merge this MR, @Utkarsh_33! ๐
- Issue was unassigned.
- Status changed to Needs work
4 months ago 1:26pm 8 August 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Too bad, the test fails on PostgreSQL for some reason ๐คทโโ๏ธ See https://git.drupalcode.org/project/experience_builder/-/jobs/2380752
To debug this, add
var_dump($this->getSession()->getPage()->getContent());
temporarily before the failing assertion.
- First commit to issue fork.
- ๐ฎ๐ณIndia omkar-pd
https://issue.pages.drupalcode.org/-/experience_builder-3464830/-/jobs/2...
The website encountered an unexpected error. Try again later. Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42883]: Undefined function: 7 ERROR: function json_extract(jsonb, unknown) does not exist LINE 4: WHERE (JSON_EXTRACT(field_xb_demo_props, '$.*.*.expression')... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.: SELECT "node__field_xb_demo"."entity_id" AS "entity_id", "node__field_xb_demo"."revision_id" AS "revision_id" FROM "test69047609node__field_xb_demo" "node__field_xb_demo" WHERE (JSON_EXTRACT(field_xb_demo_props, '$.*.*.expression')::text LIKE '%โน๏ธcommentโ%'); Array ( ) in Drupal\experience_builder\FieldTypeUninstallValidator->checkContentEntityUses() (line 212 of /builds/issue/experience_builder-3464830/src/FieldTypeUninstallValidator.php).
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Okay, so this error on PostgreSQL:
ERROR: function json_extract(jsonb, unknown) does not exist
is expected.
What is not expected, is that this runs at all, because we have
if (!isset($connection_info['default']['driver']) || $connection_info['default']['driver'] !== 'mysql') { $this->markTestSkipped('This test only runs for the MySQL database driver. See https://drupal.org/i/3452756'); }
in
FieldTypeUninstallValidatorTest
.Conclusion: we expect that
UninstallModulePageTest
will fail on PostgreSQL too. We have ๐ Ensure querying JSON nested values when parent keys are unknown is possible in all supported databases Active for this.So this needs a slight adjustment to the new
UninstallModulePageTest
and then it'll be good to go ๐ - First commit to issue fork.
- Status changed to Needs review
3 months ago 9:08pm 23 August 2024 As per #20 ๐ FieldTypeUninstallValidator: TypeError: str_starts_with(): Argument #1 ($haystack) must be of type string, null given in str_starts_with() Needs work , tweak code of UninstallModulePageTest so that test skip for PostgreSQL only as it fails for this one.
Also observed there are some pipeline failures related : \ComponentValidationTest::randomMachineName() , for this rebased the MR.
Please review, moving NR
- Status changed to Needs work
3 months ago 9:07am 26 August 2024 - Status changed to Needs review
3 months ago 11:33am 26 August 2024 - ๐ฎ๐ณIndia atul_ghate
Hi,
I reviewed MR!143, applied it against Experience Builder 0.x, and confirmed that I can go to the uninstall page without any errors. I was also able to uninstall the module and verified that the module is working correctly.
Iโve added a before-and-after screen recording for reference. RTBC+
Thank you.
- Status changed to RTBC
3 months ago 8:28am 29 August 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
The test-only CI job indeed reproduces the reported bug:
There was 1 error: 1) Drupal\Tests\experience_builder\Functional\UninstallModulePageTest::testUninstallModulePage Exception: Warning: Undefined array key "expression" Drupal\experience_builder\FieldTypeUninstallValidator->checkDefaultValueUses()() (Line: 140)
โ https://git.drupalcode.org/issue/experience_builder-3464830/-/jobs/2575834
๐
Time to ship this! ๐ข Thanks all ๐
P.S.: @atul_ghate: please do not post screenshots of a patch successfully applying. That is not remotely helpful. If the MR applies, we already know that it's an applicable patch โฆ
-
Wim Leers โ
committed 6efdbece on 0.x authored by
bhuvaneshwar โ
Issue #3464830 by pooja_sharma, utkarsh_33, Wim Leers, bhuvaneshwar,...
-
Wim Leers โ
committed 6efdbece on 0.x authored by
bhuvaneshwar โ
- Status changed to Fixed
3 months ago 8:29am 29 August 2024 - ๐บ๐ธUnited States Kristen Pol Santa Cruz, CA, USA
Perhaps a follow-up issue is needed?
kristens-mbp-2:starshot-xb kristenpol$ ddun experience_builder In PmCommands.php line 200: experience_builder: The <em class="placeholder">Experience Builder</em> field type is used in the following field: node.field_xb_demo Failed to run drush pm:uninstall experience_builder: exit status 1
- ๐บ๐ธUnited States Kristen Pol Santa Cruz, CA, USA
Ah yes of courseโฆ brain is mush.
I have seen some modules that maybe had a friendlier error message or maybe Iโm hallucinating at this point ๐
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
@kristen pol The message is much friendlier also for this scenario โฆ if you use the UI. There's only so much that's possible in a
drush
CLI context :) Automatically closed - issue fixed for 2 weeks with no activity.