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.
Hello,
with the latest dev version I have this issue when I edit my profile where a namefield is placed.
Notice: Array to string conversion in token_replace() (line 102 of /var/www/wcity/includes/token.inc).
Thanks for any help!
Frank
Edit:
I see also there are tree tokens for the field. One is a double token an not usable I think. Maybe this is the problem?
Name [user:field-name:?] Field "field_name". The following properties may be appended to the token: title (The title of the name.), given (The given name.), middle (The middle of the name.), family (The family of the name.), generational (The generational of the name.), credentials (The credentials of the name.)
Name [user:name-field-name] Name field in the default format. To specify a delta value, use "field-name:0". Append the other chained options after the delta value like this, "field-name:0:component-given". Replace the delta value with all to obtain all items in the field like this "field-name:all".
Name [user:field_name] Name field.
Comment | File | Size | Author |
---|---|---|---|
#20 | token-issues.png | 3.93 KB | Alan D. |
#19 | token-record-function-in-status-warnings.patch | 2.04 KB | Alan D. |
#5 | name-token_clash_with_realname_module-1649458-5.patch | 5.94 KB | Alan D. |
Comments
Comment #1
Alan D. CreditAttribution: Alan D. commentedThere must be two modules giving the same token value for a particular token. The issue being, which module is clashing? And which one should get updated to prevent this?
So to speed this up, can you place the following on line 101 of that file and report the various messages that are returned. Refresh at least once on that page to ensure that all token messages are returned (to catch theme based tokens too)
Or if you do not have an editor, add this line towards the end of the function, just before the return statement:
Good results should look like this:
array ( '[current-domain:machine_name]' => 'maritime', )
Bad results would look something like this:
array ( '[current-domain:machine_name]' => array('maritime', 'maritime'), )
Comment #2
Alan D. CreditAttribution: Alan D. commentedAfter just checking Profile2 and Realname modules, there are no clashes here, so it may be completely down to the Name field module generating two similar tokens....
This is the token help that I am getting for the user object with a name field without any restrictions on the tokens:
[user:field-name:?] is from Entity Tokens module.
[user:field_name] is from the Token module.
[user:name-field-name????] are from the Name Field module.
Comment #3
fraweg CreditAttribution: fraweg commentedHello,
Thanks for your fast help!
You mean the token.inc file from the error message? If have done this and get this under "user/edit":
I am not a developer so maybe I misunderstood something.
Edit:
I use Profile2 and Realname. So I deactivate the Realname module and the error is gone. But I want use the realname module :-( . With the last version "7.x-1.5" this error was not there, but the namefield did not work together with the Realname modul (The tokens does not work with Realname).
Best regards
Frank
Comment #4
fraweg CreditAttribution: fraweg commentedComment #5
Alan D. CreditAttribution: Alan D. commentedRight found the issue. When defining the tokens, I have taken the token namespace of "name-" and this directly clashes with the realname module token "name-raw".
A quick (untested) fix is to change this in the file name.token.inc around line 85:
to
I will have to get my head into the chained token logic again before deciding on the best fix.Since we are only dealing with fields here, I've added a second check to ensure that the token corresponds to an existing field. This will help reduce issues latter. So the patch contains the changes (one additional check on top of the above check) and I've pushed this into dev, but it will take up to 24 hours to roll.
Comment #6
Alan D. CreditAttribution: Alan D. commentedEven though there are no Token tests, this will re-run the other tests :)
Comment #7
fraweg CreditAttribution: fraweg commentedWith the latest dev the error is gone and work together with the Realname module.
Thanks so much for your fast and great support!
Best regards
Frank
Comment #8
Alan D. CreditAttribution: Alan D. commentedGreat news. Marking as fixed.
I will re-roll a new version soon that doesn't contain theme_name_component(), maybe an eta of 1 to 3 weeks.
Comment #10
makokis CreditAttribution: makokis commentedi still with this issue yet.
Do you know how to solve this.
thanks
Comment #11
fraweg CreditAttribution: fraweg commentedHello,
I use the actual stable token version an everything works fine for me. Which token do you use for the realname module an where did you place the field (profile2 or without profile2)?
Best regards
Frank
Comment #12
makokis CreditAttribution: makokis commentedhi thanks,
I do no have install Profile2 and RealNames modules. I use Commerce Kickstart.
The token version is Token-7.x-1.4.
In the Status report i also have a problem with tokens:
" ...The following token or token types are defined by multiple modules:
$info['tokens']['commerce-order']['site-logo'] "
...and can't find nothing about it searching in drupal.org or google to solve.
Comment #13
fraweg CreditAttribution: fraweg commentedHi,
ok I use it together with the Realname module.
This issue must be fix in the comerce-order module. I this this is not a token issue. I had have it in Heartbeat module in the past (http://drupal.org/node/1281364) and it was solved there.
Maybe this is generally the problem in your issue.
Best regards
Frank
Comment #14
makokis CreditAttribution: makokis commentedreinstalling Heartbeat module looks solved it...
the errors i have:
1- http://www.screencast.com/t/Qqu9QfwTTL
2- http://www.screencast.com/t/OfmFDK7bNgWX
...in my case, i can't reinstall a single Commerce Kickstart module, only patch, because is part of the profile of Drupal 7, not an add-on module like Heartbeat.
in any case¡ a Happy New Year 201*
FELIZ AÑO NUEVO :)
Comment #15
fraweg CreditAttribution: fraweg commentedHello,
the issue is back :-(
Now the conflict is in the new version of the module "Registration Password Token". I post the issue also there
but there is no response.
Any idea in that ?
Best regards
Frank
Comment #16
fraweg CreditAttribution: fraweg commentedHmm... no tip? :-(
Comment #17
Dave Reid@fraweg: Answer provided in #1973974: Notice: Array to string conversion in token_replace() (line 102 of /.../includes/token.inc
Comment #18
hoebekewim CreditAttribution: hoebekewim commentedThis is a dirty fix that excludes wrong values passed into the token_replace().
Use it only as a last resort, this does not solve the issue but only disables the message !
Open token.inc and change the content of the function token_replace()
Change to:
Comment #19
Alan D. CreditAttribution: Alan D. commentedUm. Token implements token_requirements() that should show warnings in the site status page. If it is complaining about something like:
Search the code for the corresponding token values. Then open a new issue in each corresponding modules queue to get this resolved.
@Dave
Would it be useful to do something like this? not pretty but provides more context to discover the cause.
Comment #20
Alan D. CreditAttribution: Alan D. commentedThis was invoked by hacking the name module to insert a duplicate user picture token.
Comment #20.0
Alan D. CreditAttribution: Alan D. commented.