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.
Per Steven, it's much easier to review and apply patches if they are all in a single patch, rather than broken up by individual files, as has sometimes been done in the past. However, there is already a patch that fixes a substantial number of these, and is relatively isolated: E_ALL compliance during installation.
Therefore, this patch will be the collection of fixes for all notices not fixed by the above patch. For now, this is just the system.module patch from http://drupal.org/node/84203.
Comment | File | Size | Author |
---|---|---|---|
#43 | notice_followup_2.patch | 26.54 KB | pwolanin |
#41 | notice_followup_1.patch | 26.81 KB | pwolanin |
#36 | notice_followup_0.patch | 22.34 KB | killes@www.drop.org |
#33 | notice_followup.patch | 1.62 KB | killes@www.drop.org |
#26 | notices_8.patch | 65.57 KB | chx |
Comments
Comment #1
webchickThis fixes some stuff on the user registration form.
Btw! I talked with Eaton and he's going to start a separate patch for all form.inc related stuff. So this patch should only include errors not related to form.inc or covered by the install patch.
Comment #2
webchickHere are some more random ones. I'm out for the rest of the day, but if anyone cares to pick up the torch, that'd be spiff-taculous!
Comment #3
asimmonds CreditAttribution: asimmonds commentedMerged in some I did yesterday
Comment #4
Dries CreditAttribution: Dries commentedI've committed this patch. I'm marking this 'active' rather than 'fixed' as I'm sure there is more. ;-)
Comment #5
chx CreditAttribution: chx commentedhttp://cvs.drupal.org/viewcvs/drupal/drupal/modules/user/user.module?r1=... I am very sure that something will break because of this change -- instead of moving specifically named form elements you do everything. This kind of change is not covered by the (unwritten) E_ALL rules...
Comment #6
chx CreditAttribution: chx commentedAs I read further, more and more badness:
this is not the same what if post accounts is set but empty? You are changing functionality. Do not do that. Sigh, now I need to read all files changed to pinpoint errors.
Comment #7
chx CreditAttribution: chx commentedmenu.inc: if ($link['link']) { if (isset($link['link'])) {
module.inc of course you can write tons of code, but the short answer is this:
theme.inc
$image_attributes = isset($image_attributes) ? $image_attributes : '';
in module.inc you used if but here, where it would be correct you did not.block.module
again not the same... but this one may pass.
and the last chunk in block, again:
form.inc has this construct since eternity for element.info and menu.inc uses it to load default values, too.
book needs to use !empty not isset... this is true for some places I mentioned already:
node
you missed the isset post nodes.
system.module
$block += array('content' => '');
, if (isset($block['block callback']) && function_exists($block['block callback'])) { again you want !empty not isset same with $style->prefix = $theme->template ? $theme->prefix : $theme->name; $style->prefix = isset($theme->template) ? $theme->prefix : $theme->name; -- this is so broken that I raised this to critical.you got to be kidding!
if (!$block['position']) { if (!isset($block['position'])) { that's empty
taxonomy
if (isset($form['taxonomy']) && is_array($form['taxonomy']) && !empty($form['taxonomy'])) {
lose isset, move !empty to the forefront.and while at it, please change the occasionnal sizeof to count, they are alias but core more uses count.
Comment #8
chx CreditAttribution: chx commentedComment #9
chx CreditAttribution: chx commentedhttp://www.blueshoes.org/en/developer/php_cheat_sheet
Comment #10
chx CreditAttribution: chx commentedThis has been rolled back.
Comment #11
webchickHa, wow. I clearly shouldn't be rolling E_NOTICE patches when I'm doing 50 billion other things. :P Thanks for the review, chx. I will try again.
Comment #12
chx CreditAttribution: chx commentedTo sum up, some general tips:
if ($foo)
that's a cast to boolean and checking for TRUE. As I already quoted,$b values does not overwrite same key $a values. There is a += operator too, and we like it.
Comment #13
chx CreditAttribution: chx commentedTo sum up, some general tips:
if ($foo)
that's a cast to boolean and checking for TRUE. As I already quoted,if (!empty($foo))
is the exact same just it does not give you a notice and there is no speed penalty. Both stem from the fact that empty is not a PHP function, it's a language construct.$a + $b
$b values does not overwrite same key $a values. There is a += operator too, and we like it.Comment #14
chx CreditAttribution: chx commentedSmall patch to fix this and that. I do not believe in catch all patches. Small is beautiful. As I go and code menu stuff , I catch notices and fix them. All shall do similarly instead of hunting them specifically IMO. This way the patch is better tested.
Comment #15
chx CreditAttribution: chx commentedborken patch
Comment #16
chx CreditAttribution: chx commentedMore!
Comment #17
chx CreditAttribution: chx commentedThis time we caught a very minor bug in menu.inc. E_ALL hunting is good.
Comment #18
webchickRe-roll after hour-long debug session on IRC. ;)
Comment #19
webchickOne small change.
This is RTBC, and fixes all non-form.inc-related notices on admin/build/modules.
Comment #20
asimmonds CreditAttribution: asimmonds commentedRemoved settings.php chunk
Comment #21
webchickd'oh!! thanks. :)
Comment #22
asimmonds CreditAttribution: asimmonds commentedThere was still a ", tab" in the menu_rebuild() SQL (left from chx's menu tabs branch)
Comment #23
chx CreditAttribution: chx commentedWe love notices.
Comment #24
chx CreditAttribution: chx commentedMore, more and more!
Comment #25
chx CreditAttribution: chx commentedwebchick found even more.
Comment #26
chx CreditAttribution: chx commentedOne more notice caught and a logic flaw is now correct... in element_child we have
$key[0] != '#';
, now if $key[0] is not set, then this is certainly true.Comment #27
webchickD'oh. This broke menus again...
After installing (with the patch applied), node/add/page gives me:
* notice: Undefined variable: return in /Applications/MAMP/htdocs/head/includes/common.inc on line 356.
* notice: Trying to get property of non-object in /Applications/MAMP/htdocs/head/includes/menu.inc on line 341.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND visible = 1 ORDER BY vancode' at line 1 query: SELECT * FROM menu WHERE pid IN () AND visible = 1 ORDER BY vancode in /Applications/MAMP/htdocs/head/includes/database.mysql.inc on line 172.
* notice: Trying to get property of non-object in /Applications/MAMP/htdocs/head/includes/menu.inc on line 399.
Should hopefully be an easy fix, since we fixed this in the first round?
Comment #28
asimmonds CreditAttribution: asimmonds commentedI think a menu_rebuild(); is required after the content types page and story are added dynamically via the install profile _profile_final().
Adding a menu_rebuild() after the _profile_final() call in install.php which works but it may not be the ideal location (but I suppose you could do anything that requires a menu rebuild in _profile_final() not just adding content types).
Comment #29
chx CreditAttribution: chx commentedYou are right but that's a different issue:http://drupal.org/node/113788
Comment #30
webchickCool. With the fixing of that issue, the menu bug is gone. Now there is just one more "critical" error, which is when you go to admin/settings/admin (at least the fifrst time), the theme and navigation disappears.
http://drupal.pastebin.us/12873 covers the last of the "clicking around and seeing notices" notices in all of core. I'm sure there are more when you have more content and are submitting various forms, etc. IMO, we should fix the rest of those in the pastebin, commit this patch, and then pick up any stragglers in another patch. It's already getting quite huge and far-reaching.
Comment #31
chx CreditAttribution: chx commentedI can't repro that bug. I will those in the pastebin now
Comment #32
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedI'd like to help getting this patch into core.
I think it is hard to get a 70k patch into core. Can we split it up a bit? I suggest splitting it up per directory:
1) modules
2) includes
3) themes
4) Root.
Comment #33
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedThe attached patch fixes some more notices I found.
Comment #34
Dries CreditAttribution: Dries commentedCommitted to CVS. Thanks.
Comment #35
Dries CreditAttribution: Dries commentedkilles: I missed your patch. I was looking at the previous patch when you submitted yours. Can you updated your tree and reroll? Thanks.
Comment #36
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedI've found plenty more notices.
Method:
- log in as user #1
- uncomment the "logout" code in user.module
- call menu_rebuild();
- truncate watchdog;
- wget -r --load-cookies="/path/to/cookies.txt" http://localhost/
Afterwards you'll have your watchdg log full of notice warnings.
Updated patch attached.
Comment #37
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedchx has spotted some errors, but I can't work on it now.
Comment #38
webchickbump. want to try and work on this again.
Comment #39
pwolanin CreditAttribution: pwolanin commentedI see a ton of notices when enabling the poll module- should I make a separate issue for that module? I don't see it in the last patch.
Comment #40
webchickno, keep it all here. Easier to test and commit.
Comment #41
pwolanin CreditAttribution: pwolanin commentedOk, starting with the patch in #36:
Hunk #1 FAILED at 1038- looks like it's already committed.
note- in this patch I added this code:
to the end of node_object_prepare(), which catches notices about unset title and body in poll, book, and maybe other modules.
Poll module is a disaster- some of it's not even updated properly for 5.x, so I couldn't fix all the notices there. It also brought up an interesting new set of notices in node module, since the poll type doesn't have a body or format.
Comment #42
pwolanin CreditAttribution: pwolanin commentedI should have marked this as "needs review" to get some attention. I'll double check that it still applies cleanly.
There's a also now an annoying warning from the menu module after the conversion to the brilliant new menu system:
Comment #43
pwolanin CreditAttribution: pwolanin commentedAttached patch re-rolled and fixes an additional undefined index (left, right) in system module, and leaves out one line in system module that's already been fixed elsewhere. Otherwise, the patch is the same just with different line numbers.
Almost all these changes are trivial, but please review!
Comment #44
chx CreditAttribution: chx commenteddo not switch on menu module yet.
Comment #45
pwolanin CreditAttribution: pwolanin commented@chx- sorry, but I don't know what you mean. The item above relating to menu.inc is not something I tried to address in the patch (the patch contains no changes in menu.inc), it was just an observation. Sorry for clouding the issue.
Comment #46
tostinni CreditAttribution: tostinni commentedRegarding the profile module's notices:
1/ I think we can add a new one in
profile_view_field
, it should beif (isset($user->{$field->name}) && $value = $user->{$field->name}) {
instead ofif ($value = $user->{$field->name}) {
when browsing an user profile without any datas.I would like to roll this patch again but it's very broken for the moment (I guess for chx menu's change, so I'll wait a little.
2/ This patch update all $form['fields'] blindly in
profile_field_form
.It leads to some problems.
Ex: we have
which is only available while creating a "selection" profile field. So when doing the INSERT (in
profile_field_form_submit
), $form_values['options'] isn't set so lead to a NOTICE.So I think we should better do the check for isset at query level
db_query("INSERT INTO... ", %s ..., $form_values['title'], ..., isset($edit['options']) ? $edit['options'] : '', ...);
Comment #47
bdragon CreditAttribution: bdragon commentedI don't think this one is going to fly. Closing outright.
Autopatch Results for notice_followup_2.patch:
patching file modules/color/color.module
Hunk #1 succeeded at 157 with fuzz 2 (offset 10 lines).
patching file modules/forum/forum.module
Hunk #1 succeeded at 472 (offset 29 lines).
Hunk #3 succeeded at 498 (offset 29 lines).
Hunk #4 FAILED at 510.
Hunk #5 succeeded at 508 with fuzz 1 (offset 6 lines).
1 out of 5 hunks FAILED -- saving rejects to file modules/forum/forum.module.rej
patching file modules/node/content_types.inc
Hunk #1 FAILED at 34.
Hunk #2 succeeded at 141 (offset -4 lines).
1 out of 2 hunks FAILED -- saving rejects to file modules/node/content_types.inc.rej
patching file modules/node/node.module
Hunk #1 succeeded at 355 with fuzz 1 (offset 63 lines).
Hunk #2 FAILED at 642.
Hunk #3 FAILED at 737.
Hunk #4 FAILED at 1590.
Hunk #5 succeeded at 2043 with fuzz 1 (offset 121 lines).
Hunk #6 succeeded at 3025 (offset 89 lines).
Hunk #7 FAILED at 3036.
misordered hunks! output would be garbled
Hunk #8 FAILED at 3006.
5 out of 8 hunks FAILED -- saving rejects to file modules/node/node.module.rej
patching file modules/poll/poll.module
Hunk #1 succeeded at 133 (offset 21 lines).
Hunk #2 FAILED at 199.
Hunk #3 succeeded at 225 (offset -4 lines).
Hunk #4 succeeded at 412 (offset 21 lines).
Hunk #5 FAILED at 430.
Hunk #6 succeeded at 435 (offset -2 lines).
Hunk #7 succeeded at 541 (offset 21 lines).
Hunk #8 FAILED at 633.
3 out of 8 hunks FAILED -- saving rejects to file modules/poll/poll.module.rej
patching file modules/profile/profile.module
Hunk #1 succeeded at 255 (offset 25 lines).
Hunk #3 succeeded at 299 (offset 25 lines).
patching file modules/system/system.install
Hunk #1 succeeded at 87 (offset -5 lines).
patching file modules/system/system.module
Hunk #1 FAILED at 1498.
Hunk #2 FAILED at 1853.
Hunk #3 succeeded at 2507 (offset 316 lines).
2 out of 3 hunks FAILED -- saving rejects to file modules/system/system.module.rej
patching file modules/upload/upload.module
Hunk #1 FAILED at 344.
1 out of 1 hunk FAILED -- saving rejects to file modules/upload/upload.module.rej
patching file modules/user/user.module
Hunk #1 FAILED at 1835.
Hunk #2 succeeded at 2940 (offset 279 lines).
Hunk #3 FAILED at 2979.
2 out of 3 hunks FAILED -- saving rejects to file modules/user/user.module.rej
can't find file to patch at input line 532
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: modules/watchdog/watchdog.module
|===================================================================
|RCS file: /cvs/drupal/drupal/modules/watchdog/watchdog.module,v
|retrieving revision 1.171
|diff -u -p -r1.171 watchdog.module
|--- modules/watchdog/watchdog.module 27 Feb 2007 12:29:22 -0000 1.171
|+++ modules/watchdog/watchdog.module 18 Mar 2007 01:58:47 -0000
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
patching file includes/install.inc
patching file includes/theme.inc
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file includes/theme.inc.rej