Possible bug in blocks

Possible bug in blocks

by Tim Hunt -
Number of replies: 3
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
But I don't understand blocks.

I getting errors from about like 885 of blocklib.php which says

        $blocknames = explode(',', $posblocks[$i]);

I think this does the wrong thing if $posblocks[$i] is '' (for example if you have no blocks in either the left or right column). Instead I think it should be

        $blocknames = $posblocks[$i] ? explode(',', $posblocks[$i]) : array();      

Can someone who understands these things either confirm or deny. Thanks.
Average of ratings: -
In reply to Tim Hunt

Re: Possible bug in blocks

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
array() makes more sense to me than FALSE.
In reply to Martin Dougiamas

Re: Possible bug in blocks

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
This issue is the stupid feature of explode, where if you explode an empty string, you get array(''), instead of array(), which is always what you want, so you always need an if statement.