πŸ‡ΊπŸ‡ΈUnited States @byrond

Account created on 19 April 2011, over 13 years ago
#

Merge Requests

Recent comments

πŸ‡ΊπŸ‡ΈUnited States byrond

If type hints are not sufficient, and you need to add the #[Autowire] attribute, you must also include the following use statement in your file:

use Symfony\Component\DependencyInjection\Attribute\Autowire;

πŸ‡ΊπŸ‡ΈUnited States byrond

Should the hook_update_last_removed() implementation be removed from 2.2.x? My understanding is that the hook is to ensure that updates are not skipped if they are removed and required. Since these database updates are not required for 2.2.x, the last removed update probably does not need to be reported. I assume the updates can remain in 2.1.x, and if they are removed, the last removed would need to be set there (unless they are not required for the latest 2.1.x version either).

πŸ‡ΊπŸ‡ΈUnited States byrond

I installed this on a Drupal 11 example site and experienced no issues or errors.

πŸ‡ΊπŸ‡ΈUnited States byrond

Our solution for this was to use Field Formatter Filter β†’ and create a text format with only the Glossify filter. Then, we were able to add that as an additional filter for the fields where we want Glossify to work. Editors do not need access to the text format with this solution, and you don't need to change the text format of your content.

πŸ‡ΊπŸ‡ΈUnited States byrond

Here is an example Views query:

SELECT DISTINCT "node_field_data"."created" AS "node_field_data_created", "node_field_data"."nid" AS "nid", "eh_for_node_field_data"."nid" AS "eh_for_node_field_data_nid"
FROM
{node_field_data} "node_field_data"
INNER JOIN (SELECT "eh_child"."id" AS "eh_child_id", "eh_child"."revision_id" AS "eh_child_revision_id", "eh_parent"."id" AS "nid"
FROM
{nested_set_field_book_page_parent_node_node} "eh_child"
INNER JOIN {nested_set_field_book_page_parent_node_node} "eh_parent" ON (eh_child.left_pos BETWEEN eh_parent.left_pos AND eh_parent.right_pos) AND eh_parent.depth = 0) "eh_for_node_field_data" ON node_field_data.nid = eh_for_node_field_data.eh_child_id AND eh_for_node_field_data.eh_child_revision_id = node_field_data.vid
WHERE ("node_field_data"."status" = '1') AND ("node_field_data"."langcode" IN ('***LANGUAGE_language_interface***')) AND ("eh_for_node_field_data"."title" LIKE 'Some title' ESCAPE '\\')
ORDER BY "node_field_data_created" DESC

And the error when trying to use the relationship to filter by a field on the related node:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'eh_for_node_field_data.title' in 'where clause'

πŸ‡ΊπŸ‡ΈUnited States byrond

We experienced the same thing. When using the relationship to get the root entity of the hierarchy, we are unable to filter by anything related to the root (title, content type, etc.). We only have access to the nid of the root node. We tried also adding a relationship to "get the actual content of the node revision" based on the root (Top) relationship, but there is no vid to join by.

πŸ‡ΊπŸ‡ΈUnited States byrond

This option has been shown in the past to prevent Chrome from crashing during JavaScript tests. Are you sure there won't be any negative side-effects for removing it?

πŸ‡ΊπŸ‡ΈUnited States byrond

It did not fix our issue. I'm not sure the cache clear will help in this case, because it is trying to create the field, which can't succeed until a field exists to be picked up by getDerivativeDefinitions().

Here is our stack trace:

 [error]  TypeError: uasort(): Argument #1 ($array) must be of type array, null given in uasort() (line 65 of /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php) #0 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php(65): uasort(NULL, Array)
#1 /var/www/html/docroot/core/modules/field/field.module(414): Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager->getPluginId('node', 'entity_hierarch...')
#2 [internal function]: field_field_config_create(Object(Drupal\field\Entity\FieldConfig))
#3 /var/www/html/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(409): call_user_func_array(Object(Closure), Array)
#4 /var/www/html/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'field')
#5 /var/www/html/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(408): Drupal\Core\Extension\ModuleHandler->invokeAllWith('field_config_cr...', Object(Closure))
#6 /var/www/html/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(341): Drupal\Core\Extension\ModuleHandler->invokeAll('field_config_cr...', Array)
#7 /var/www/html/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(434): Drupal\Core\Config\Entity\ConfigEntityStorage->invokeHook('create', Object(Drupal\field\Entity\FieldConfig))
#8 /var/www/html/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(357): Drupal\Core\Config\Entity\ConfigEntityStorage->_doCreateFromStorageRecord(Array, true)
#9 /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(1059): Drupal\Core\Config\Entity\ConfigEntityStorage->importCreate('field.field.nod...', Object(Drupal\Core\Config\Config), Object(Drupal\Core\Config\Config))
#10 /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(842): Drupal\Core\Config\ConfigImporter->importInvokeOwner('', 'create', 'field.field.nod...')
#11 /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(663): Drupal\Core\Config\ConfigImporter->processConfiguration('', 'create', 'field.field.nod...')
#12 /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php(561): Drupal\Core\Config\ConfigImporter->processConfigurations(Array)
#13 /var/www/html/docroot/core/lib/Drupal/Core/Config/Importer/ConfigImporterBatch.php(31): Drupal\Core\Config\ConfigImporter->doSyncStep('processConfigur...', Array)
#14 /var/www/html/docroot/core/includes/batch.inc(296): Drupal\Core\Config\Importer\ConfigImporterBatch::process(Object(Drupal\Core\Config\ConfigImporter), 'processConfigur...', Array)
#15 /var/www/html/docroot/core/includes/form.inc(974): _batch_process()
#16 /var/www/html/docroot/core/includes/install.core.inc(660): batch_process(Object(Drupal\Core\Url), Object(Drupal\Core\Url))
#17 /var/www/html/docroot/core/includes/install.core.inc(578): install_run_task(Array, Array)
#18 /var/www/html/docroot/core/includes/install.core.inc(121): install_run_tasks(Array, Array)
#19 /var/www/html/vendor/drush/drush/includes/drush.inc(69): install_drupal(Object(Composer\Autoload\ClassLoader), Array, Array)
#20 /var/www/html/vendor/drush/drush/includes/drush.inc(53): drush_call_user_func_array('install_drupal', Array)
#21 /var/www/html/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php(169): drush_op('install_drupal', Object(Composer\Autoload\ClassLoader), Array, Array)
#22 [internal function]: Drush\Commands\core\SiteInstallCommands->install('minimal', Array)
#23 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#24 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#25 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#26 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#27 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /var/www/html/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
#34 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#35 /var/www/html/vendor/bin/drush(119): include('/var/www/html/v...')
#36 {main}. 

My proposal was to make sure plugin derivatives get created for every entity type, whether or not a field exists already, but I don't know enough about this module to understand why that will break things.

πŸ‡ΊπŸ‡ΈUnited States byrond

Created an issue fork and rerolled patch from #12 so it will apply to the latest 3.x and 3.3.10.

Still needs tests.

πŸ‡ΊπŸ‡ΈUnited States byrond

byrond β†’ made their first commit to this issue’s fork.

πŸ‡ΊπŸ‡ΈUnited States byrond

Marking this as "needs work" based on my concern above. An more secure approach is to add trusted proxy addresses to settings.php using $settings['reverse_proxy_addresses']. When these are set, Drupal will strip those addresses from X-Forwarded-For, leaving the client's real IP as the only one in the header. Drupal will trust that IP as long as the request was received from a trusted proxy. This does mean that list must be maintained as the CDN changes those addresses.

The Restrict by IP module allows you to configure the header that contains the client's real IP. This is often configured on the CDN (sometimes called "True-Client-IP") and can be trusted by Drupal when that is the case. We are working on a patch for this module to add the same functionality and will post it in a separate issue.

πŸ‡ΊπŸ‡ΈUnited States byrond

This should likely not be merged without making this behavior optional (and adding a warning about enabling it). From the getClientIps() method documentation:

     * In the returned array the most trusted IP address is first, and the
     * least trusted one last. The "real" client IP address is the last one,
     * but this is also the least trusted one. Trusted proxies are stripped.
     *
     * Use this method carefully; you should use getClientIp() instead.

https://github.com/symfony/symfony/blob/6.2/src/Symfony/Component/HttpFo...

We considered using this patch for a client using Akamai but aren't comfortable with the security risk associated with trusting all addresses in X-Forwarded-For.

πŸ‡ΊπŸ‡ΈUnited States byrond

#430 works for us on 8.8.2 and also passes tests for 8.9, whereas #434 is currently failing.

Production build 0.71.5 2024