Uncaught RangeError: invalid array length thrown in site.js when launching a popup with a Gutenberg Video block on autoplay
marklchaves opened this issue · 5 comments
Describe the bug
Uncaught RangeError: invalid array length thrown in site.js when launching a popup with a Gutenberg Video block on autoplay.
Site information
Popup Maker version: 1.16.2
WordPress version: 5.8.2
PHP version: 7.4.1
Expected behavior
Popup should display and automatically play the MP4 video.
Current behavior
The popup doesn't display on the first try and a stack trace is logged to the browser console.
The popup sometimes displays the second try and onward.
Steps to reproduce
- Create a popup with Gutenberg enabled.
- Add a Gutenberg video block, insert an MP4 video, and enable all video block options.
- Create an auto display or click trigger.
- Launch the popup and view the error in the browser console.
Or, visit this page and launch popup number 4.
https://streetphotography.blog/video-popups/#mp4-loop-autoplay-playsinline-popup-using-gutenberg
Errors
Uncaught RangeError: invalid array length
divider https://streetphotography.blog/wp-content/plugins/popup-maker/assets/js/site.min.js?defer&ver=1.16.2:1
popup_event_header https://streetphotography.blog/wp-content/plugins/popup-maker/assets/js/site.min.js?defer&ver=1.16.2:1
https://streetphotography.blog/wp-content/plugins/popup-maker/assets/js/site.min.js?defer&ver=1.16.2:1
jQuery 7
open https://streetphotography.blog/wp-content/plugins/popup-maker/assets/js/site.min.js?defer&ver=1.16.2:1
popmake https://streetphotography.blog/wp-content/plugins/popup-maker/assets/js/site.min.js?defer&ver=1.16.2:1
open https://streetphotography.blog/wp-content/plugins/popup-maker/assets/js/site.min.js?defer&ver=1.16.2:1
https://streetphotography.blog/video-popups/:2640
jQuery 2
site.min.js:1:28044
Additional context
Temporary workaround
assets/js/site.js line 2203
try {
line 2239
} catch (err) {
console.log("[PUM] '" + err + "' in site.js line just before line 2240.");
}
@marklchaves This is related to the Debug Mode, divider
and popup_event_header
are all method names in the debug console rendering code.
So you might want to check out this line here:
Looks like that new Array
is getting a negative value, causing the error.
Testing potential fix 3d2e3f7
The root cause ended up being popup names longer than 62 characters.
I updated the proposed fix and submitted PR 996.
@marklchaves wow, great catch, who would have thought.
The fix was released back on May 27.