the whole site stopped working after updating for this module
log error
Auf der Website ist ein unvorhergesehener Fehler aufgetreten. Bitte versuchen Sie es später nochmal.

TypeError: explode(): Argument #2 ($string) must be of type string, array given in explode() (line 19 of modules/contrib/views_attach_library/views_attach_library.module).
views_attach_library_views_pre_render(Object)

I flushed cache with no luck and disabled the module for the the sake of getting rid of the error.

CommentFileSizeAuthor
Screenshot 2024-03-19 at 09.29.54.png444.03 KBwaed94ep
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Waed94EP created an issue. See original summary.

waed94ep’s picture

Issue summary: View changes
waed94ep’s picture

Issue summary: View changes

--

waed94ep’s picture

Issue summary: View changes

Raveen Thakur made their first commit to this issue’s fork.

raveen_thakur51’s picture

Still not able to reproduce, what/how happened here!!

Mohd Sahzad made their first commit to this issue’s fork.

mohd sahzad’s picture

Status: Active » Needs review
raveen_thakur51’s picture

@Mohd, You are checking case only when it comes as string but, the error raised is for -
$libraries = $view_config['display_options']['display_extenders']['library_in_views_display_extender']['attach_library'];
if (is_string($libraries)) {

for second argument, If the error persists, (still i am not able to reprouce) The code won't goes upto your changes. It still shows error.
Could you please let me know more about error, how you reproduced it. I was keeping an eye on it from yesterday.
Can you address the error for me. Please & Thank You.

raveen_thakur51’s picture

Status: Needs review » Active
raveen_thakur51’s picture

Issue summary: View changes

Can you please share your test results?? Thank You!!

raveen_thakur51’s picture

Issue summary: View changes
raveen_thakur51’s picture

MIstakenly updated/added comment in ticket bio.

lazzyvn’s picture

Hmm I'm retesting carefully with drupal 10.2 PHP8.2 but I can't reproduce this problem. I changed explode function, you can try with dev version or you goto your view configuration and save it again

  • 6aa9d7ad committed on 2.0.x
    Issue #3432027: TypeError: explode(): Argument #2 ($string) must be of...

david.muffley’s picture

This occurs on my site as well. You can replicate it by installing version 2.0.3, saving a view with a value in the attach_library field, and then upgrading the module to 2.0.4. That version changed the array lookup where the string is stored (it removed a second `attach_library`) but didn't update any existing information. I suggest adding an update hook to fix the data stored in every view.

  • lazzyvn committed 2009e37f on 2.0.x
    Issue #3432027: TypeError: explode(): Argument #2 ($string) must be of...
lazzyvn’s picture

@david.muffley Yes, you're right. there are new fixes in the development version, which will make it work, no need to create an update hook to fix all views. please confirm

themusician’s picture

Status: Active » Reviewed & tested by the community

The new 2.0.5 release fixed this issue where I was seeing it.

lazzyvn’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.