Skip to content

Conversation

@rmuit
Copy link
Contributor

@rmuit rmuit commented Jan 21, 2021

These are all notices which I encountered while running simpletest-D6 (https://github.com/rmuit/simpletest) on PHP7.4 / PHP8.0. Regular (non-Pressflow) Drupal will never see them because drupal_error_handler() ignores PHP Notice / Deprecated messages. Eek.

But I figured I'd scoop them up into 1 PR for those interested.

None of these fixes cover up bugs; every notice happens in cases where the 'input' value is legit.

Most of them are simple one-line fixes, except:

  • The fix to _drupal_build_css_path() which I found in https://www.drupal.org/project/drupal/issues/3084953 makes the code look strange / doesn't explain what is going on, so I changed it and added PHPDoc. (_drupal_build_css_path() is a preg_replace callback.)
  • I suspect db_result() was never meant to be called inside of a foreach loop, because: see the comments I made (and the code). So arguably the callers are 'buggy.' However there are so many 'buggy' callers that I opted to fix and comment db_result() instead. (Core block.module does it, but also I found the following modules on my own file system doing it: boost, comment_revisions, ibiblio, imagecache, masquerade, path_redirect, pathauto, salesforce, sf_webform, simpletest, twitter, ubercart, views_bulk_operations, weblinks, xmlsitemap.)

* An array of mlid, title pairs for use as options for selecting a book page.
*/
function book_toc($bid, $exclude = array(), $depth_limit) {
function book_toc($bid, $exclude, $depth_limit) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP8.0 emits a "Deprecated" notice. Look at us being future proof ;)


$order = _forum_get_topic_order($sortby);
for ($i = 0; $i < count($forum_topic_list_header); $i++) {
for ($i = 1; $i < count($forum_topic_list_header); $i++) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for this change being good, can be seen in line 576 ^

@izmeez
Copy link

izmeez commented Mar 7, 2022

The changes were applied as one patch to a site and caused a conflict with the captcha module causing it to fail every time. I have not had time to apply each segment individually to identify the culprit hunk. See https://www.drupal.org/project/d6lts/issues/3267856

@rmuit
Copy link
Contributor Author

rmuit commented Jun 12, 2022

See https://www.drupal.org/project/d6lts/issues/3267856#comment-14559831 for why I think (in my case) the captcha module apparently always fails since version 2.6. Plus a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants