Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm getting multiple occurrences of the following errors when I select a field type when adding a new formatter. This is a new install of 2.4. I'm just trying this module for the first time, so this was the first formatter I tried to create.
Warning: preg_match_all() expects parameter 2 to be string, array given in /path/to/includes/common.inc on line 7534
Warning: array_unique() expects parameter 1 to be array, null given in /path/to/includes/common.inc on line 7535
Warning: Invalid argument supplied for foreach() in /path/to/includes/common.inc on line 7538
The errors occur during an AJAX call when I select a field type and are repeated 13 times.
Comments
Comment #1
ExTexan CreditAttribution: ExTexan commentedI also get the same errors when selecting a different "format".
Comment #2
Deciphered CreditAttribution: Deciphered commentedI have not seen that error; Can you confirm it on http://ply.st/custom_formatters? If so, please provide reproduction steps.
Comment #3
ExTexan CreditAttribution: ExTexan commentedHmmm. As you said, it didn't occur in the sandbox. It must be a conflict with, or actually caused by, another module, but without any clues as to which other module might be involved, I'm at a loss as to telling you the steps to reproduce.
Feel free to close this issue if you wish.
Comment #4
Deciphered CreditAttribution: Deciphered commentedIt could could be many things, a module, server configuration, etc.
I'd love to know the cause in the case I can prevent others from having the issue. If you can provide any information you think might be relevant?
Comment #5
ExTexan CreditAttribution: ExTexan commented@Deciphered, I admire your tenacity on this. How could I *not* step up and at least try to help you nail down this problem (if it is, in fact, a problem with your module)?
First, my apologies that the following backtrace array is incomplete. If you recall, this error is coming up in an AJAX call, so the "print" of the array appears in a popup text window generated by the browser (I guess). Perhaps the browser allocates limited space to the text window. Or maybe the fact that the array is incomplete is a clue about the issue itself (memory issues, perhaps?).
Second, my apologies if the formatting (indentation) of the array is not correct. In the text window, it was all left-justified, so I had to copy/paste it into my editor and do the indentation myself (a tedious task, to say the least).
Third, sorry it is so long. I think the part you need is at the top (the "args" section for "drupal_explode_tags"), but I included as much as I could, just in case it might be helpful.
Comment #6
Deciphered CreditAttribution: Deciphered commentedHi ExTexan,
Thanks for the follow up, greatly appreciated.
I'm pretty certain that the issue in question is valid, it's just clearly a little tricky to reproduce. If it is what I think it is, it's related to the Preview controls and the problematic last minute change I made just before releasing 2.3 which prompted a 2.4 release.
This particular issue should be already fixed in the latest dev release. I will have to push out a 2.5 release soon, but I actually want some substantial changes to be in it before I do so (of which I do have some in mind already).
Let me know if the Dev release resolves the issue for you, and thanks again for following up.
Cheers,
Deciphered.
Comment #7
ExTexan CreditAttribution: ExTexan commented@Deciphered,
I finally found time to try the dev version. Alas, it didn't fix the issue. :-(
Comment #8
Deciphered CreditAttribution: Deciphered commentedCan you post a stack trace again? Or at least just the first couple entries?
Comment #9
japanitrat CreditAttribution: japanitrat commentedSame problem here, btw
Comment #10
japanitrat CreditAttribution: japanitrat commentedHmm, I feel like it has something to do with the text which is being trimmed. I just tried it on my site where I had two nodes of the same type. In one it worked, in the other one the text got repeated. The difference between the two was that second one had significantly more markup, like long
span
s with style attributes (CKEditor added it for some reason). When I made it shorter, and removed the redundant markup, the issue got fixed. I guess the text was trimmed at a position where it was missing a closing tag (like a</p>
)Comment #11
Deciphered CreditAttribution: Deciphered commented@japanitrat If you can give me the content of the fields and the formatter so that I can reproduce the issue, then I can try to fix the issue.
If you can run through http://simplytest.me to determine 100% reproducible steps, then post those steps here.
Comment #12
japanitrat CreditAttribution: japanitrat commentedArgh, sorry Deciphered, wrong issue queue (I meant to post it here: https://www.drupal.org/node/1678334#comment-10612876).
Still have the problem described in this thread, though. Will try to give you a reproducible flow.
Comment #13
japanitrat CreditAttribution: japanitrat commentedOkay well, it's pretty simple to reproduce actually.
Go to http://simplytest.me, add custom formatters, run. Go to Structure -> Custom Formatters, and change the select field value to something other than PHP code. Now go to Reports -> Recent Log Messages, you'll see the error (warning) mentioned in this issue.
If your PHP config treats errors as warnings, you actually have a problem.
Now, if you add Devel to the mix and enable Krumo backtrace, the custom-formatter-config page actually becomes unusable.
P.S.: here is the vanilla installation example (only custom formatters added to the installation): https://dmgia.ply.st/#overlay=admin/reports/dblog
Comment #14
Deciphered CreditAttribution: Deciphered commentedI'm not sure if this issue was already resolved in Dev, or if the steps here on reproducing the issue aren't clear, but I am unable to reproduce the issue.
Closing for now, feel free to re-open if you are still having the issue, and provide clearer steps (Go to Structure -> Custom Formatters, and change the select field value; there's no select field with 'PHP code' on the specified page).
Comment #15
bohemier CreditAttribution: bohemier commentedReopening this...
Actually japanitrat is right, it's just missing a step (Add new formatter). To reproduce : Go to Structure -> Custom Formatters -> Add formatter then change Format from PHP to something else. If your Development setting displays errors and warnings, you'll get a javascript popup error message (Warning : preg_match_all() expects parameter 2 to be string, array given), otherwise you won't. Using the latest dev.
Thanks!
Comment #16
supriyarajgopal CreditAttribution: supriyarajgopal commentedSubscribing. Message appears in watchdog.
It could be because of this that I am unable to preview anything for an Entity Reference field in a field collection.
The latest dev version of this module solved my problem.
Regards,
Supriya Rajgopal