Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-79902

PHP 8.3: Negative indices in arrays

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor Minor
    • None
    • 4.3.1, 4.4
    • General

      https://stitcher.io/blog/override-in-php-83

      $array = [];
       
      $array[-5] = 'a';
      $array[] = 'b';
       
      var_export($array);
       
      //array (
      //  -5 => 'a',
      //  0 => 'b',
      //)
      

      Starting from PHP 8.3, the next item will be added at index -4:

      //array (
      //  -5 => 'a',
      //  -4 => 'b',
      //)
      

      Required

      I don't think there's anything we can do to automatically detect this, or any way to confirm it.

      Creating this issue to:

      1. get a second opinion on my analysis of detecting this
      2. give us somewhere to link to if we do find instances of it

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Raquel Ortega Raquel Ortega
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.