Closed (fixed)
Project:
Skinr
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Aug 2010 at 22:02 UTC
Updated:
8 May 2014 at 10:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jacineDid you run update.php?
Comment #2
bobbungee commentedI didn't have an old version of the module before. This is a fresh install.
Comment #3
travisc commentedI'm seeing this on a fresh install too
Comment #4
ericduran commentedI just looked at the code. This is an actual bug.
There's no check on the array index. This can probably be fixed with an isset in certain locations.
Comment #5
bobbungee commentedComment #6
jacineAnyone want to write a patch? :)
Comment #7
ericduran commentedThese are just notices not errors and this still need to be fixed properly but one way around it is to set php.in error_reporting = E_ALL & ~E_NOTICE .
Drupal 6 is E_ALL compliance but there's a lot of contrib module that aren't.
That being said I'm going to change the Issue title to something more appropriate.
Comment #8
jacineI cannot reproduce these at all, and I have E_ALL set.
Comment #9
ericduran commented@jacine, yep. You're absolutely right. I did confirm this problem before but I think recent changes the the skin_skinset fix it. I think it was something related the the static cache not being used. I did a quick search but didn't find it.
But I guess we can mark this one closed.
Comment #10
jacineOk, good, because I thought I was going insane. I tried for a while to reproduce, and nothing.
Thanks :)
Comment #11
juan_g commentedSorry to reopen, but I'm also getting many notice lines -the same notices of this issue- in fresh installs of the current Skinr 6.x-2.x-dev (Sep 28, 2010). For example:
These are caused by:
skinr.module, line 865, function skinr_skinsets
skinr.module, line 929, function skinr_skinset_statuses
Drupal documentation:
Write E_ALL compliant code (6.x, 7.x)
Related issues:
Let's make Drupal 6 E_ALL compliant (6.x)
E_ALL compliance during installation (6.x)
E_ALL compliance: remove notices on installation screens (5.x)
Those are core issues, but include ideas that can be applied to modules, for development and released versions.
Comment #12
jacineThanks @juan_g. I had tried setting this in settings.php and .htaccess and still wasn't getting the errors, so today I hacked core, and was finally able to see these.
Here's a patch.
Comment #13
juan_g commentedThank you very much, the patch has fixed it by using isset; no more notices left. Will this fix be included in the next Skinr 6.x-2.x, dev or alpha? :)
Comment #14
juan_g commentedUnless other testers find something not correct, and since it's just applying isset, I think this is RTBC.
Tested with Skinr, Skinr UI, and dependencies enabled.
Comment #15
ericduran commentedThere's an extra $output variable that's not really being used
Comment #16
juan_g commentedThis one? (skinr_ui.admin.inc file):
I think that looks ok. It's used some lines later in the same function:
Comment #17
jacine@ericduran That's for the admin page that lists the skinsets. I was getting a notice there when there where no skinsets on $output.
I have a feeling there are more of these lurking around, but I committed this to dev. Now I need to port this to 1.x-dev and D7.
Comment #18
ericduran commented@jacine, cool. :) I'm working on the other issues :-)
Comment #19
juan_g commentedDepending on the case, something to consider is !empty() :
Comment #20
jacineI read that, and also this:
I think
isset()was the right choice, but TBH, I'm not sure.Comment #21
juan_g commentedReading PHP docs, I've just made this boolean table. Not completely sure, but it seems at least mostly right. Please correct me if you see any mistake.
It depends on what is exactly needed, but if(!empty($var)) looks like the replacement for if($var) with the most similar behavior, without "undefined" notices.
Comment #22
moonray commentedIn general (and in this case) !empty() is better to use than isset(). They did a bunch of testing on it, and it's apparently faster than isset().
The reason to use !empty() in this instance is because the default parameter value, if nothing is passed, is FALSE. FALSE should not trigger the refresh (which it would if you use isset).
Comment #23
jacineThanks @moonray.
This needs work then.
Comment #24
sunA theme's status should always be set, so I do not understand this isset().
The function signature defines a default of FALSE for $refresh, so $refresh should never be not set --- unless something, anything, calls this function with a second argument of NULL, which most likely is not the case.
Powered by Dreditor.
Comment #25
jacineComment #26
moonray commentedActually a theme's status isn't always set, apparently (though why that is, I have no idea). See comment #11.
I think that should be a check for !empty() instead of isset(), though.
The $refresh check should indeed not be set.
None of these appear in the D7 version, though. These are all D6 notices.
Comment #27
nomonstersinme commentedyeah, I can't get these notices to show in drupal 7
Comment #28
moonray commentedAlright, moving back to D6 since this isn't an issue in D7.
Comment #29
vrajak@gmail.com commentedFrom reading it seems like that status here is that its pending a patch to 1.x-dev and the current code needs some revision? Like the use of empty() over isset() and The $refresh check should indeed not be set as Moonray said. With some direction I could try and help out unless its already being done or out of my capability.
Comment #30
moonray commentedSettings back to D6 since none of the issues reported above apply to code in D7.
Comment #31
moonray commentedAny code improvements mentioned above, like isset() vs !empty(), aren't crucial here. No notices appear anymore, so closing.