I downloaded and enabled the Skinr module, and I got a lot of errors thrown at me. I tried both the stable and the dev versions.

Here are the errors:

    * Notice: Undefined index: style in acquia_slate_button() (line 15 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/themes/acquia_slate/template.php).
    * Notice: Undefined index: #upload_validators in acquia_slate_button() (line 15 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/themes/acquia_slate/template.php).
    * Notice: Undefined variable: skinr in include() (line 26 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/themes/acquia_slate/page.tpl.php).
    * Notice: Undefined property: stdClass::$status in skinr_skinsets() (line 819 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined property: stdClass::$status in skinr_skinsets() (line 819 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined property: stdClass::$status in skinr_skinsets() (line 819 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined property: stdClass::$status in skinr_skinsets() (line 819 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined property: stdClass::$status in skinr_skinsets() (line 819 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined property: stdClass::$status in skinr_skinsets() (line 819 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined index: pushbutton in skinr_skinset_statuses() (line 883 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined index: minnelli in skinr_skinset_statuses() (line 883 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined index: garland in skinr_skinset_statuses() (line 883 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined index: marvin in skinr_skinset_statuses() (line 883 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined index: chameleon in skinr_skinset_statuses() (line 883 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined index: bluemarine in skinr_skinset_statuses() (line 883 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined index: zen in skinr_skinset_statuses() (line 883 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined index: fusion_starter_lite in skinr_skinset_statuses() (line 883 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined index: fusion_starter in skinr_skinset_statuses() (line 883 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined index: fusion_core in skinr_skinset_statuses() (line 883 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined index: acquia_slate in skinr_skinset_statuses() (line 883 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr.module).
    * Notice: Undefined variable: output in theme_skinr_ui_admin_skins() (line 850 of /Users/{user}/Documents/Devel/Drupal/site/sites/all/modules/skinr/skinr_ui.admin.inc).
CommentFileSizeAuthor
#12 skinr_e_all.patch1.87 KBJacine
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jacine’s picture

Did you run update.php?

bobbungee’s picture

I didn't have an old version of the module before. This is a fresh install.

travisc’s picture

I'm seeing this on a fresh install too

ericduran’s picture

I 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.

bobbungee’s picture

Category: support » bug
Jacine’s picture

Anyone want to write a patch? :)

ericduran’s picture

Title: Post Installation Errors » Make skinr e_all complience

These 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.

Jacine’s picture

I cannot reproduce these at all, and I have E_ALL set.

ericduran’s picture

@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.

Jacine’s picture

Status: Active » Closed (fixed)

Ok, good, because I thought I was going insane. I tried for a while to reproduce, and nothing.

Thanks :)

juan_g’s picture

Title: Make skinr e_all complience » Make Skinr E_ALL compliant
Status: Closed (fixed) » Active

Sorry 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:

notice: Undefined property: stdClass::$status in /var/www/clients/client0/web7/web/sites/all/modules/skinr/skinr.module on line 865.
(...)
notice: Undefined index: garland in /var/www/clients/client0/web7/web/sites/all/modules/skinr/skinr.module on line 929.

These are caused by:

skinr.module, line 865, function skinr_skinsets

        $skinset->status = $theme->status ? 1 : 0;

skinr.module, line 929, function skinr_skinset_statuses

  return $statuses[$skinset_name];

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.

Jacine’s picture

Status: Active » Needs review
FileSize
1.87 KB

Thanks @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.

juan_g’s picture

Thank 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? :)

juan_g’s picture

Unless 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.

ericduran’s picture

Status: Needs review » Reviewed & tested by the community

There's an extra $output variable that's not really being used

juan_g’s picture

This one? (skinr_ui.admin.inc file):

function theme_skinr_ui_admin_skins($form) {
+  $output = '';

I think that looks ok. It's used some lines later in the same function:

  $output .= drupal_render($form['options']);

(...)

  // Output table.
  $output .= theme('table', $headers, $rows);

  $output .= drupal_render($form);

  return $output;
Jacine’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

@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.

ericduran’s picture

@jacine, cool. :) I'm working on the other issues :-)

juan_g’s picture

Depending on the case, something to consider is !empty() :

The difference between isset() and !empty() is that unlike !empty(), isset() will return TRUE even if the variable is set to an empty string or zero. In order to decide which one to use, consider whether '' or 0 are valid and expected values for your variable.

(Write E_ALL compliant code)

Jacine’s picture

I read that, and also this:

The function isset() returns TRUE when the variable is set to 0, but FALSE if the variable is set to NULL. In some cases, is_null() is a better choice, especially when testing the value of a variable returned by an SQL query.

I think isset() was the right choice, but TBH, I'm not sure.

juan_g’s picture

Reading 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.

$var values $var isset($var) is_null($var) empty($var) !empty($var)
not set, unset FALSE, with notice ("undefined") FALSE TRUE, with notice ("undefined") TRUE FALSE
NULL FALSE FALSE TRUE TRUE FALSE
0 FALSE TRUE FALSE TRUE FALSE
0.0 FALSE TRUE FALSE TRUE FALSE
"" FALSE TRUE FALSE TRUE FALSE
"0" FALSE TRUE FALSE TRUE FALSE

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.

moonray’s picture

In 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).

Jacine’s picture

Status: Patch (to be ported) » Needs work

Thanks @moonray.

This needs work then.

sun’s picture

+++ skinr.module	Working Copy
@@ -862,7 +862,7 @@
-        $skinset->status = $theme->status ? 1 : 0;
+        $skinset->status = isset($theme->status) ? 1 : 0;

A theme's status should always be set, so I do not understand this isset().

+++ skinr.module	Working Copy
@@ -915,7 +915,7 @@
 function skinr_skinset_statuses($skinset_name, $refresh = FALSE) {
...
-  if ($refresh) {
+  if (isset($refresh)) {

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.

Jacine’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
moonray’s picture

Actually 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.

nomonstersinme’s picture

yeah, I can't get these notices to show in drupal 7

moonray’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev

Alright, moving back to D6 since this isn't an issue in D7.

vrajak@gmail.com’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

From 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.

moonray’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev

Settings back to D6 since none of the issues reported above apply to code in D7.

moonray’s picture

Status: Needs work » Fixed

Any code improvements mentioned above, like isset() vs !empty(), aren't crucial here. No notices appear anymore, so closing.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.