Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
http://localhost/drupal/admin/structure/features/cleanup/clear
After calling cleanup seeing:
Notice: Array to string conversion in features_get_orphans() (line 700 of /home/s8weber/svc/drupal/app/drupal/profiles/uwlib_profile/modules/contrib/features/features.module).
Notice: Array to string conversion in features_get_orphans() (line 700 of /home/s8weber/svc/drupal/app/drupal/profiles/uwlib_profile/modules/contrib/features/features.module).
Notice: Array to string conversion in features_get_orphans() (line 700 of /home/s8weber/svc/drupal/app/drupal/profiles/uwlib_profile/modules/contrib/features/features.module).
....
Looking into the features.module i did some debugging:
function features_get_orphans($reset = FALSE) {
...
var_dump($modules[$module]->required_by);
echo 'ssssssssssssssssssssssssssss';
var_dump($enabled);
die;
$dependents = array_intersect($modules[$module]->required_by, $enabled);
...
And the debugging output truncated:
array(16) {
["date_views"]=>
array(1) {
["name"]=>
string(5) "views"
}
["draggableviews"]=>
array(1) {
["name"]=>
string(5) "views"
.......
}
ssssssssssssssssssssssssssss
array(57) {
["strongarm"]=>
string(9) "strongarm"
["block"]=>
string(5) "block"
["webform"]=>
string(7) "webform"
..........
}
It seems that the format of the array has changed
$modules[$module]->required_by is nested array of strings.
$enabled = module_list() is array of strings .
Drupal 7.x commit 33234ac2d
Date: Wed Sep 5 22:58:31 2012 -0700
Comment | File | Size | Author |
---|---|---|---|
#31 | features-array_to_string_fix-1776738-31.patch | 639 bytes | marcelovani |
#18 | features-array_to_string_fix-1776738-18.patch | 639 bytes | Jaesin |
#15 | features-array_to_string_fix-1776738-15.patch | 643 bytes | haxney |
#14 | features-array2string-1776738-14.patch | 635 bytes | waverate |
#4 | 1776738.patch | 186 bytes | eldrupalista |
Comments
Comment #1
steverweber CreditAttribution: steverweber commentedAlso hit another notice.
Comment #2
btopro CreditAttribution: btopro commentedAlso reproducing this in local development. Not sure that it's major but it is slightly annoying when doing a lot of features development
Comment #3
mpotter CreditAttribution: mpotter commentedDo you have a step-by-step procedure for triggering this that you can share? Looks like it only happens when there are orphaned dependencies and I've had a hard time making this happen easily.
Comment #4
eldrupalista CreditAttribution: eldrupalista commentedMeanwhile a better solution is provided, you can fix this including this piece of code:
Check the attached patch, apply in features.module file.
My version of Features is 7.x-1.0
Comment #5
eldrupalista CreditAttribution: eldrupalista commentedComment #6
mpotter CreditAttribution: mpotter commentedCan you please roll that patch properly? I don't see any of the normal "git diff" header information in your patch file. Also, for patch naming, please see http://drupal.org/patch/submit.
(This is a simple enough patch that I'll try to take a look, but you should learn how to submit patches properly or you'll run into trouble with the community)
Comment #7
mpotter CreditAttribution: mpotter commentedAlso, seems like your code should be modifying the $dependents array and not the $modules[$module]->required_by[$module_name] array directly.
Comment #8
Topcheese CreditAttribution: Topcheese commentedI've not had a chance to look at the code, nor test on another server yet, but I did get this error after upgrading to the latest dev release. I suspect that it's possibly PHP 5.4+ related, as the latest dev cleared up a different string to array conversion error.
Notice: Array to string conversion in EntityAPIControllerExportable->applyConditions()Edit: This issue seems to still exist. The latest Entity API dev had cleared up the other issue which was related to PHP 5.4+
Comment #9
kclarkson CreditAttribution: kclarkson commentedI to am getting this message: Array to string conversion in features_get_orphans() (line 714
I have upgraded my MAMP which is now PHP 5.4.4 not sure if this helps.
@mpotter
I tried adding the code
foreach($modules[$module]->required_by as $module_name => $dependency){
$modules[$module]->required_by[$module_name] = $dependency['name'];
}
in the .module file around lines 700 but it didn't remove the error. Anyway to help us out on this ?
Thanks
K
Comment #10
Topcheese CreditAttribution: Topcheese commentedHi, I haven't had the chance to get to my old issue queue, and I'm also currently using PHP 5.3, so I'm not sure I can help.
Edit: I believe what it was is that I had the same issue when using PHP 5.4+. I just listed the other issue in #8 because it was 5.4+ related. All I can say for sure is that at some point updating Entity API helped me with an issue.
Now that the Commons Beta is out I plan to spend more time organizing my issues and helping out with the Commons issue queue.
Comment #11
kclarkson CreditAttribution: kclarkson commentedIs this patch ready to go ? Error is def driving me a little bonkers :)
Updating Entity API did not fix the error.
Comment #12
Topcheese CreditAttribution: Topcheese commented@Kclarkson, I believe your answer can be found following this issue
Array to string conversion error from line 625 of entity/includes/entity.controller.inc. I'm pretty sure you have to apply the patch yourself as it has not made it into any release yet. There are also others having issues with PHP5.4 and you might want to see what solutions worked for them.Comment #13
waverate CreditAttribution: waverate commentedSimilar to another Features issue #1588596: Notice: Array to string conversion in features_export_prepare() (line 190 of features.export.inc) that was solved with a patch.
Notices exist using:
I do not have the Entity API module installed so I doubt the patch at #12 (entity/includes/entity.controller.inc) is the solution.
Comment #14
waverate CreditAttribution: waverate commentedPatch at #4 worked for me against features-7.x-2.0-beta1
Re-uploading it.
Comment #15
haxney CreditAttribution: haxney commentedHere is a patch against
7.x-2.0-beta1
which solves the problem for me. This is a correctly-formatted version of the code from #1776738-4: Notice: Array to string conversion in features_get_orphans.Comment #16
steverweber CreditAttribution: steverweber commentedThanks haxney, it seemed to solve the issue.
I hope the maintainer pulls this patch in soon.
Comment #17
pfrenssenI haven't tested the patch but it is not compliant to coding standards and is not correctly indented.
Comment #18
Jaesin CreditAttribution: Jaesin commentedI only made the comment #15 patch code complaint.
Comment #19
jlporter CreditAttribution: jlporter commented#18 is a go
Comment #20
drwits CreditAttribution: drwits commentedsame here. 18 worked for me
Comment #21
kingfisher64 CreditAttribution: kingfisher64 commented#18 worked lovely. Let's get this committed asap :)
Comment #22
steverweber CreditAttribution: steverweber commented+1
Comment #23
kclarkson CreditAttribution: kclarkson commentedrtbc
Comment #24
thelee CreditAttribution: thelee commentedcan we get this committed and rolled out?
NOTE - does this actually break anything or is it just a minor warning - IE can i still be using features just fine in php 5.4?
Comment #25
mpotter CreditAttribution: mpotter commentedCommitted to b84e900.
Comment #27
joelwallis CreditAttribution: joelwallis commentedHi.
Do you have a plan to incorporate this bugfix to the 1.x branch?
Comment #28
nedjoBug is present in 1.x, so patch should be backported.
Comment #29
hefox CreditAttribution: hefox commentedI don't believe anything is being backported to 1.x
Comment #31
marcelovaniI am still using 1.x, will upload the patch here, in case other people still want to use it.
Comment #32
mpotter CreditAttribution: mpotter commentedThere is no reason to be using 1.x. 1.x is deprecated and no longer supported. 2.x is fully compatible with 1.x.
Thanks for the patch, but closing the issue as a won't-fix.
Comment #33
donquixote CreditAttribution: donquixote commentedNot happy with what was committed 7 years ago.
(found this issue with git blame)
TLDR:
- The function is not used anymore since #719308: Remove orphan module detection. So the problems I mention here are mostly theoretical.
- The function, if called, will poison original objects cached in other functions (this was introduced here).
- The function is not properly documented. It is not clear from the doc what it does.
- The function seems to not really work. It will return an empty list most of the time.
- It contains a redundant call to _module_build_dependencies() which is pointless because features_get_modules() already adds this info (indirectly).
Poisoning
@mpotter (#7)
Absolutely.
With the current version (as introduced here), original objects (cached in other places) are poisoned.
Not working
Why do I say it does not work?
The structure of ->required_by seems to be like this:
After the (poisoning) modification introduced here, it is like this:
This means the array_intersect() below will never be empty, and thus the module won't count as orphan:
The
$modules[$module]->required_by
will always contain the module itself as a value, which is also in $enabled, so the module is never counted as orphan.Why do I care
I am doing some (non-disruptive) clean-up on the features module.
If I find some defunct leftovers, I want to at least document it.