BrightEdgeFactory.php causes massive amount of PHP warnings

Created on 25 January 2021, almost 4 years ago
Updated 5 April 2023, over 1 year ago

Problem/Motivation

There are PHP warnings for nearly every page load due to an incorrect path in the brightedge module; it calls for vendor/autoload.php with a relative transversal URL that fails every time docroot/modules/contrib/be_ixf_drupal/src/Factory/BrightEdgeFactory.php is called.

This results in hundreds of PHP warnings per minute, PHP overhead and database bloat if those warnings are logged in dblog.

Here is the include on line 6 of BrightEdgeFactory.php:

/* Can comment out if you have modified merge-plugin in the top level composer.json */
include_once __DIR__ . '../../../vendor/autoload.php';

The actual relative location in my project would require traversing 6 directories back, not 3, because that is where vendor directory lies in this composer-managed project. However, possibly we can comment out the line because the project is composer-managed?

Because this module does not supply documentation, unless requested from the service vendor, this is not a well-documented configuration requirement.

Steps to reproduce

Install, enable, configure, and deploy module in a composer-managed project wherein the file structure is as follows:

project-root
├── docroot
│   ├── libraries
│   └── modules
└── vendor

Proposed resolution

Form a better URL path that represents a wider variety of installs? Document the workarounds or changes for client developers in service vendor's installation documentation? This would require a patch in our project, because it is managed by composer and it is deployed via continuous integration, which rebuilds dependencies for testing and deployment installation.

Remaining tasks

Documentation of proper configuration for module in Composer-managed projects.

Sample warning message

Warning: include_once(/mnt/www/html/projectname/docroot/modules/contrib/be_ixf_drupal/src/Factory../../../vendor/autoload.php): failed to open stream: No such file or directory in include_once() (line 6 of /mnt/www/html/projectname/docroot/modules/contrib/be_ixf_drupal/src/Factory/BrightEdgeFactory.php)
#0 /mnt/www/html/projectname/docroot/core/includes/bootstrap.inc(600): _drupal_error_handler_real(2, 'include_once(/m...', '/mnt/www/html/u...', 6, Array)
#1 /mnt/www/html/projectname/docroot/modules/contrib/be_ixf_drupal/src/Factory/BrightEdgeFactory.php(6): _drupal_error_handler(2, 'include_once(/m...', '/mnt/www/html/u...', 6, Array)
#2 /mnt/www/html/projectname/docroot/modules/contrib/be_ixf_drupal/src/Factory/BrightEdgeFactory.php(6): include_once()
#3 /mnt/www/html/projectname/vendor/symfony/class-loader/ApcClassLoader.php(112): require('/mnt/www/html/u...')
#4 [internal function]: Symfony\Component\ClassLoader\ApcClassLoader->loadClass('Drupal\\be_ixf_d...')
#5 [internal function]: spl_autoload_call('Drupal\\be_ixf_d...')
#6 /mnt/www/html/projectname/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(255): call_user_func_array(Array, Array)
#7 /mnt/www/html/projectname/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\Container->createService(Array, 'brightedge.requ...')
#8 /mnt/www/html/projectname/docroot/core/lib/Drupal.php(158): Drupal\Component\DependencyInjection\Container->get('brightedge.requ...')
#9 /mnt/www/html/projectname/docroot/modules/contrib/be_ixf_drupal/be_ixf_drupal.module(53): Drupal::service('brightedge.requ...')
#10 /mnt/www/html/projectname/docroot/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(297): be_ixf_drupal_page_attachments(Array)
#11 /mnt/www/html/projectname/docroot/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(273): Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array)
#12 /mnt/www/html/projectname/docroot/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(117): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#13 /mnt/www/html/projectname/docroot/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#14 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#15 /mnt/www/html/projectname/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#16 /mnt/www/html/projectname/vendor/symfony/http-kernel/HttpKernel.php(156): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent))
#17 /mnt/www/html/projectname/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#18 /mnt/www/html/projectname/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /mnt/www/html/projectname/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /mnt/www/html/projectname/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /mnt/www/html/projectname/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /mnt/www/html/projectname/vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php(49): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /mnt/www/html/projectname/docroot/modules/contrib/purge_queuer_url/src/StackMiddleware/UrlRegistrar.php(168): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /mnt/www/html/projectname/docroot/modules/contrib/shield/src/ShieldMiddleware.php(91): Drupal\purge_queuer_url\StackMiddleware\UrlRegistrar->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /mnt/www/html/projectname/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\shield\ShieldMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /mnt/www/html/projectname/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /mnt/www/html/projectname/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /mnt/www/html/projectname/docroot/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /mnt/www/html/projectname/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#30 {main}
🐛 Bug report
Status

Closed: duplicate

Version

5.4

Component

Code

Created by

🇺🇸United States utcwebdev

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024