After uploading the image in "PARAGRAPHS BROWSER SETTINGS" > "Upload image" > getting error like below:
Error: Call to a member function getFileUri() on array in paragraphs_browser_paragraph_type_form_builder() (line 125 of /var/www/html/docroot/modules/contrib/paragraphs_browser/paragraphs_browser.module)
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3355760-6.patch | 1.96 KB | daveferrara1 |
Issue fork paragraphs_browser-3355760
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
Comment #4
ranjit1032002Created MR!5 for the issue mentioned, please review.
Thank You.
Comment #5
texas-bronius commentedTwo cents here - - I experienced the same error uploading an image to use for Paragraphs Browser (on a D9 site), and applying the patch https://git.drupalcode.org/project/paragraphs_browser/-/merge_requests/5... from #3 above does overcome that error, but I then see another error:
```
TypeError: mb_strlen(): Argument #1 ($string) must be of type string, array given in mb_strlen() (line 333 of /app/public_html/core/lib/Drupal/Core/Form/FormValidator.php)
#0 /app/public_html/core/lib/Drupal/Core/Form/FormValidator.php(333): mb_strlen(Array)
...
```
Related or not, I don't know, but when I forgo this nice image upload method and instead plop the img right into, say, a custom themes path, I can let the image file convey with code/config: win-win!
Comment #6
daveferrara1 commentedHere is a patch. the "...mb_strlen()" WSOD is because in ln333 since the #maxlength check is truthy, #value is assumed to be a string. The maxlength is set in form_alter of the module on the file field. Here is a patch that updates the file field and includes what is unmerged in the pull request that was opened to add a check for "instanceof \Drupal\file\Entity\File".
There was also another issue with the uriScheme from Issue 3284847 and this patch adds some reorg/linting at the top.
Comment #7
jiggli commentedpatch on #6 worked for me!
Comment #8
mndonx commentedThis patch worked for me too, thank you!
To test:
- Edited a paragraph
- Tried to upload a Paragraph Browser image (under "Paragraphs Browser Settings")
- Got the error described in the issue
- Checked to see if the image got added anyway (it did not)
- Applied the patch
- Tried uploading a paragraph browser image again
- This time it worked with no error
- Ensured that the image now appears when adding a new paragraph to a page in the Paragraph Browser
Changing status to RTBC.
Comment #9
serkanb commentedAnother confirm on patch #6, works for me as well.
Comment #11
gregglesAdding credit for stefvanlooveren who proposed part of the fix here before this issue was created over in #3284847: Error: Call to undefined method Drupal\Core\File\FileSystem::uriScheme() . I'm marking that as a duplicate of this one since this has more folks and fixes more issues.
Comment #12
greggles@daveferrarra1 would you consider making your patch into changes in the MR?
Comment #14
yevko commentedMR doesn't work and produces the same error TypeError: mb_strlen(): mentioned in #5, and patch from #6 fixes the issue
Comment #17
spuky commentedAdded Patch 6 to the MR
Comment #18
bvoynickComment #19
bvoynickComment #20
bvoynickComment #22
bvoynick