#57662 closed defect (bug) (fixed)
Fatal Error: _preload_old_requests_classes_and_interfaces() when updating from WordPress older than 4.6
| Reported by: |  | Owned by: |  | 
|---|---|---|---|
| Milestone: | 6.2 | Priority: | normal | 
| Severity: | normal | Version: | 6.2 | 
| Component: | Upgrade/Install | Keywords: | has-test-info has-patch commit | 
| Focuses: | Cc: | 
Description
During the 6.2-beta1 release party I got the following error (see image).
I'm using a local test site just for the release party. I was on 6.1.1 and used Core Rollback to revert to 4.0.38. I have WordPress Beta Tester set to 'Bleeding Edge' and 'Beta/RC'.
I initially tried 4.038, 4.1.37 both initially failed. The I updated from 5.9.5 and worked my way back down the releases from each major. I retried the first 2 again and they passed.
Core Rollback and WordPress Beta Tester at current releases used.
Attachments (1)
Change History (17)
    
      
         
        
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
      
      
3 years ago
    
    
  
              
    
      
    #2
  
    
        
          
             @
 @
            
3 years ago
        
    
  
  
  - Component changed from General to Upgrade/Install
- Milestone changed from Awaiting Review to 6.2
- Version set to trunk
    
      
    #4
  
    
        
          
             @
 @
            
3 years ago
        
    
  
  
  - Keywords needs-patch added
Requests was introduced in WordPress 4.6, see #33055.
- GitHub - WordPress 4.5: https://github.com/WordPress/wordpress-develop/tree/4.5/src/wp-includes
- GitHub - WordPress 4.6: https://github.com/WordPress/wordpress-develop/tree/4.6/src/wp-includes
Looks like we need a minimum version check in _preload_old_requests_classes_and_interfaces().
Preparing a patch now.
    
      
         
        
This ticket was mentioned in PR #4029 on WordPress/wordpress-develop by @costdev.
      
      
3 years ago
    
    
      
    #5
  
    
    
  
  - Keywords has-patch added; needs-patch removed
The Requests library was introduced in WordPress 4.6.
Attempting to preload the Requests 1.x classes/interfaces in earlier versions of WordPress
causes a fatal error.
This skips preloading if the website previously used a WordPress version earlier than 4.6.
Trac ticket: https://core.trac.wordpress.org/ticket/57662
    
      
    #6
  
    
        
          
             @
 @
            
3 years ago
        
    
  
  
    Test Report
Patch tested: https://github.com/WordPress/wordpress-develop/pull/4029
To test the patch, refer to these custom update package test instructions.
Environment
- Hardware: iMac
- OS: macOS 12.6.2
- Browser: Safari 16.2
- Server: Apache/2.4.55 (Unix) PHP/5.6.40
- PHP: 5.6.40
- WordPress: 6.1.1
- Theme: twentytwentyone v1.6
- Active Plugins:
- core-rollback v1.3.4
- wordpress-beta-tester v3.2.7
- fake-wordpress-update (see the test instructions above)
 
Actual Results
When reproducing a bug:
- "Fatal error: Class 'Requests_Exception'" occurred when attempting to update.
When testing a patch to validate it works as expected:
- Using a patched build package, the update to 6.2-beta1 succeeded without error.
Additional Notes
- In test Step 2, ensure that a classic theme is active. I was unable to roll back past 5.9 with a block theme active.
- For clarity, the fatal error that occurred prevented the update, but did leave the site in a usable state (i.e. I was able to then test the patched build).
    
      
    #7
  
    
        
          
             @
 @
            
3 years ago
        
    
  
  
    Test Report
Patch tested: https://github.com/WordPress/wordpress-develop/pull/4029
Test instructions provided by @ironprogrammer: https://gist.github.com/ironprogrammer/1aaff6f60b263c1842e3584365729ffc
Environment
- Hardware: Mac mini M1
- wp-env
- OS: macOS 13.1
- PHP: 5.6.39
- WordPress: 6.2-beta1
- Browser: Safari 16.2
- Theme: Twenty Twelve
- Active Plugins:
- core-rollback v1.3.4
- wordpress-beta-tester v3.2.7
- fake-wordpress-update (see the test instructions above)
 
Actual Results
When reproducing a bug:
- ❌ "Fatal error: Class 'Requests_Exception'" occurred when attempting to update.

When testing a patch to validate it works as expected:
- ✅ No errors when updating to the patched version of WordPress.
Notes
If you are testing the patch on wp-env: 
- You may need to use this workaround to install WordPress on PHP 5.6: https://github.com/WordPress/gutenberg/issues/40745#issuecomment-1422471660
- Also, when creating a custom WordPress package, you will need to upload it to a server accessible from the Internet (I used GitHub). Otherwise, WordPress will not see it (due to wp-env).
    
      
    #8
  
    
        
          
             @
 @
            
3 years ago
        
    
  
  
  - Owner set to hellofromTonya
- Status changed from new to reviewing
Currently reviewing for commit.
    
      
    #9
  
    
        
          
             @
 @
            
3 years ago
        
    
  
  
  - Keywords commit added
https://github.com/WordPress/wordpress-develop/pull/4029
- 2 Test Reports ✅
- Resolves the reported issue ✅
- Bails out immediately to skip Requests preloading logic ✅
Ready for commit 👍 
    
      
         
        
@hellofromTonya commented on PR #4029:
      
      
3 years ago
    
    
      
    #12
  
    
    
  
  
Committed via https://core.trac.wordpress.org/changeset/55296.
    
      
    #13
  
    
        
          
             @
 @
            
3 years ago
        
    
  
  
  - Summary changed from Error from _preload_old_requests_classes_and_interfaces on update from 4.0.38 to 6.2-beta1 to Fatal Error: _preload_old_requests_classes_and_interfaces() when updating from WordPress older than 4.6
Renamed for the root cause.
    
      
    #14
  
    
        
          
             @
 @
            
3 years ago
        
    
  
  
    
For upgrades from 4.5 and earlier, does the previous library need to be pre-loaded in a similar fashion?
I suspect the answer is no but I'd sure feel silly if I didn't ask and it became a problem.

Testing Instructions
These steps define how to reproduce the issue, and indicate the expected behavior.
Steps to Reproduce
WP_DEBUG,WP_DEBUG_LOGandWP_DEBUG_DISPLAYinwp-config.php.Core RollbackandWordPress Beta Testerplugins.Tools > Rollback Core.4.0.38from the<select>element and click Rollback.Dashboard > Updatesand click Re-install 4.0.38.Tools > Beta Testing.Bleeding EdgeandBeta/RC only. Click Save Changes.Dashboard > Updatesand click Update now.Expected Results
When testing a patch to validate it works as expected:
When reproducing a bug: