[wp-trac] [WordPress Trac] #65094: AI: Prompt construction fails with fatal error when wp_ai_client_default_request_timeout filter returns negative number

WordPress Trac noreply at wordpress.org
Sat Apr 18 18:52:53 UTC 2026


#65094: AI: Prompt construction fails with fatal error when
wp_ai_client_default_request_timeout filter returns negative number
--------------------------------------+--------------------------
 Reporter:  westonruter               |       Owner:  westonruter
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  7.0
Component:  AI                        |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+--------------------------

Comment (by jarodortegaaraya):

 Patch Testing Report – Ticket #65094

 I tested the patch locally in a WordPress 7.0 environment.

 Summary:
 The patch successfully prevents a fatal error when invalid values are
 returned via the wp_ai_client_default_request_timeout filter. Previously,
 invalid values (e.g., -1) caused an uncaught exception in
 RequestOptions::validateTimeout().

 Testing Performed:

 Returning -1 → Falls back to default (30) → No fatal error ✅
 Returning 45.5 → Value applied correctly ✅
 Returning null → Timeout disabled as expected ✅
 Returning invalid type (array) → Falls back to default → No fatal error ✅

 Additional Observation:
 A PHP warning was encountered during testing due to an undefined variable
 ($default_timeout) after applying the patch manually. This appears to be
 related to the local modification rather than the intended patch behavior.

 Conclusion:
 The patch works as expected. It properly validates the timeout value,
 prevents fatal errors, and handles invalid input gracefully.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/65094#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list