From e9687619bb3f3ca9bc426a7d66813571dfcc36bd Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Mon, 27 Oct 2025 10:03:16 -0700 Subject: [PATCH 1/9] Update strpos.xml with error handling details Added error handling information for offset parameter, after observing this un/underdocumented fatal in production. Note: Using the github web editor, I am not sure if I can pull a second file into this PR, so I may submit a second PR to handle `stripos`. --- reference/strings/functions/strpos.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reference/strings/functions/strpos.xml b/reference/strings/functions/strpos.xml index a8b1aeed6aef..765ef172c8a3 100644 --- a/reference/strings/functions/strpos.xml +++ b/reference/strings/functions/strpos.xml @@ -49,6 +49,9 @@ the beginning of the string. If the offset is negative, the search will start this number of characters counted from the end of the string. + + A fatal error will be thrown if offset exceeds the length of haystack. + @@ -68,6 +71,13 @@ &return.falseproblem; + + &reftitle.errors; + + An E_ERROR level error is generated if offset exceeds the length of haystack. + + + &reftitle.changelog; From 360f39a8160717fae0e1bf56987f1d8f29464120 Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Mon, 27 Oct 2025 10:06:20 -0700 Subject: [PATCH 2/9] Document error for offset exceeding haystack length Added error handling information for offset parameter. --- reference/strings/functions/stripos.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reference/strings/functions/stripos.xml b/reference/strings/functions/stripos.xml index e30d830b6e86..e7dc86c0902a 100644 --- a/reference/strings/functions/stripos.xml +++ b/reference/strings/functions/stripos.xml @@ -53,6 +53,9 @@ the beginning of the string. If the offset is negative, the search will start this number of characters counted from the end of the string. + + A fatal error will be thrown if offset exceeds the length of haystack. + @@ -72,6 +75,13 @@ &return.falseproblem; + + &reftitle.errors; + + An E_ERROR level error is generated if offset exceeds the length of haystack. + + + &reftitle.changelog; From 3d0cae19eafaa5d96d796e576da9cbbe32077ecd Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Mon, 27 Oct 2025 10:09:51 -0700 Subject: [PATCH 3/9] Document error for exceeding offset length Added error handling information for offset parameter. --- reference/mbstring/functions/mb-strpos.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reference/mbstring/functions/mb-strpos.xml b/reference/mbstring/functions/mb-strpos.xml index 444650d64329..10bb6287e686 100644 --- a/reference/mbstring/functions/mb-strpos.xml +++ b/reference/mbstring/functions/mb-strpos.xml @@ -55,6 +55,10 @@ The search offset. If it is not specified, 0 is used. A negative offset counts from the end of the string. + + A fatal error will be thrown if offset + exceeds the length of haystack. + @@ -77,6 +81,14 @@ + + &reftitle.errors; + + An E_ERROR level error is generated if offset + exceeds the length of haystack. + + + &reftitle.changelog; From f5e04a51964bfda6539620aa0a4d72154a1fd643 Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Mon, 27 Oct 2025 10:11:34 -0700 Subject: [PATCH 4/9] Document error for offset exceeding haystack length Added error handling information for offset parameter. --- reference/mbstring/functions/mb-stripos.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reference/mbstring/functions/mb-stripos.xml b/reference/mbstring/functions/mb-stripos.xml index 6cae80fb140a..c9ee4a361da7 100644 --- a/reference/mbstring/functions/mb-stripos.xml +++ b/reference/mbstring/functions/mb-stripos.xml @@ -53,6 +53,10 @@ to start searching. A negative offset counts from the end of the string. + + A fatal error will be thrown if offset + exceeds the length of haystack. + @@ -76,6 +80,14 @@ + + &reftitle.errors; + + An E_ERROR level error is generated if offset + exceeds the length of haystack. + + + &reftitle.changelog; From 99c925184769deb6c09e951df9892fb17a1618dd Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Mon, 27 Oct 2025 14:43:53 -0700 Subject: [PATCH 5/9] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tim Düsterhus --- reference/mbstring/functions/mb-stripos.xml | 15 +++++++-------- reference/mbstring/functions/mb-strpos.xml | 15 +++++++-------- reference/strings/functions/stripos.xml | 13 +++++++------ reference/strings/functions/strpos.xml | 13 +++++++------ 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/reference/mbstring/functions/mb-stripos.xml b/reference/mbstring/functions/mb-stripos.xml index c9ee4a361da7..925af7149e97 100644 --- a/reference/mbstring/functions/mb-stripos.xml +++ b/reference/mbstring/functions/mb-stripos.xml @@ -53,10 +53,6 @@ to start searching. A negative offset counts from the end of the string. - - A fatal error will be thrown if offset - exceeds the length of haystack. - @@ -82,10 +78,13 @@ &reftitle.errors; - - An E_ERROR level error is generated if offset - exceeds the length of haystack. - + + + If offset is greater than the length of + haystack, a + ValueError will be thrown. + + diff --git a/reference/mbstring/functions/mb-strpos.xml b/reference/mbstring/functions/mb-strpos.xml index 10bb6287e686..a2d7420b3dbc 100644 --- a/reference/mbstring/functions/mb-strpos.xml +++ b/reference/mbstring/functions/mb-strpos.xml @@ -55,10 +55,6 @@ The search offset. If it is not specified, 0 is used. A negative offset counts from the end of the string. - - A fatal error will be thrown if offset - exceeds the length of haystack. - @@ -83,10 +79,13 @@ &reftitle.errors; - - An E_ERROR level error is generated if offset - exceeds the length of haystack. - + + + If offset is greater than the length of + haystack, a + ValueError will be thrown. + + diff --git a/reference/strings/functions/stripos.xml b/reference/strings/functions/stripos.xml index e7dc86c0902a..423f4cf71ffc 100644 --- a/reference/strings/functions/stripos.xml +++ b/reference/strings/functions/stripos.xml @@ -53,9 +53,6 @@ the beginning of the string. If the offset is negative, the search will start this number of characters counted from the end of the string. - - A fatal error will be thrown if offset exceeds the length of haystack. - @@ -77,9 +74,13 @@ &reftitle.errors; - - An E_ERROR level error is generated if offset exceeds the length of haystack. - + + + If offset is greater than the length of + haystack, a + ValueError will be thrown. + + diff --git a/reference/strings/functions/strpos.xml b/reference/strings/functions/strpos.xml index 765ef172c8a3..86f083a97f9c 100644 --- a/reference/strings/functions/strpos.xml +++ b/reference/strings/functions/strpos.xml @@ -49,9 +49,6 @@ the beginning of the string. If the offset is negative, the search will start this number of characters counted from the end of the string. - - A fatal error will be thrown if offset exceeds the length of haystack. - @@ -73,9 +70,13 @@ &reftitle.errors; - - An E_ERROR level error is generated if offset exceeds the length of haystack. - + + + If offset is greater than the length of + haystack, a + ValueError will be thrown. + + From 0fcf4858cbed6844be56c32694c0272bf8c20c47 Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Mon, 27 Oct 2025 23:43:55 +0000 Subject: [PATCH 6/9] Apply review suggestions --- reference/mbstring/functions/mb-stripos.xml | 5 ++++- reference/mbstring/functions/mb-strpos.xml | 7 +++++-- reference/strings/functions/stripos.xml | 7 +++++-- reference/strings/functions/strpos.xml | 7 +++++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/reference/mbstring/functions/mb-stripos.xml b/reference/mbstring/functions/mb-stripos.xml index 925af7149e97..e3f73a4086fa 100644 --- a/reference/mbstring/functions/mb-stripos.xml +++ b/reference/mbstring/functions/mb-stripos.xml @@ -78,13 +78,16 @@ &reftitle.errors; - + + &csprng.errors; + If offset is greater than the length of haystack, a ValueError will be thrown. + diff --git a/reference/mbstring/functions/mb-strpos.xml b/reference/mbstring/functions/mb-strpos.xml index a2d7420b3dbc..38ae899ccb0f 100644 --- a/reference/mbstring/functions/mb-strpos.xml +++ b/reference/mbstring/functions/mb-strpos.xml @@ -79,13 +79,16 @@ &reftitle.errors; - + + &csprng.errors; + If offset is greater than the length of haystack, a ValueError will be thrown. - + + diff --git a/reference/strings/functions/stripos.xml b/reference/strings/functions/stripos.xml index 423f4cf71ffc..5d423817a0ba 100644 --- a/reference/strings/functions/stripos.xml +++ b/reference/strings/functions/stripos.xml @@ -74,13 +74,16 @@ &reftitle.errors; - + + &csprng.errors; + If offset is greater than the length of haystack, a ValueError will be thrown. - + + diff --git a/reference/strings/functions/strpos.xml b/reference/strings/functions/strpos.xml index 86f083a97f9c..a3183dbfafa6 100644 --- a/reference/strings/functions/strpos.xml +++ b/reference/strings/functions/strpos.xml @@ -70,13 +70,16 @@ &reftitle.errors; - + + &csprng.errors; + If offset is greater than the length of haystack, a ValueError will be thrown. - + + From 1faeabfa6807a7d34014029fad76ef3cc05db65d Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Tue, 28 Oct 2025 16:34:22 +0000 Subject: [PATCH 7/9] Remove csprng-specific html entity --- reference/mbstring/functions/mb-stripos.xml | 1 - reference/mbstring/functions/mb-strpos.xml | 1 - reference/strings/functions/stripos.xml | 1 - reference/strings/functions/strpos.xml | 1 - 4 files changed, 4 deletions(-) diff --git a/reference/mbstring/functions/mb-stripos.xml b/reference/mbstring/functions/mb-stripos.xml index e3f73a4086fa..192ea0a092e6 100644 --- a/reference/mbstring/functions/mb-stripos.xml +++ b/reference/mbstring/functions/mb-stripos.xml @@ -79,7 +79,6 @@ &reftitle.errors; - &csprng.errors; If offset is greater than the length of diff --git a/reference/mbstring/functions/mb-strpos.xml b/reference/mbstring/functions/mb-strpos.xml index 38ae899ccb0f..b7ec05bd9056 100644 --- a/reference/mbstring/functions/mb-strpos.xml +++ b/reference/mbstring/functions/mb-strpos.xml @@ -80,7 +80,6 @@ &reftitle.errors; - &csprng.errors; If offset is greater than the length of diff --git a/reference/strings/functions/stripos.xml b/reference/strings/functions/stripos.xml index 5d423817a0ba..65890b9a08ed 100644 --- a/reference/strings/functions/stripos.xml +++ b/reference/strings/functions/stripos.xml @@ -75,7 +75,6 @@ &reftitle.errors; - &csprng.errors; If offset is greater than the length of diff --git a/reference/strings/functions/strpos.xml b/reference/strings/functions/strpos.xml index a3183dbfafa6..d788148cfd9e 100644 --- a/reference/strings/functions/strpos.xml +++ b/reference/strings/functions/strpos.xml @@ -71,7 +71,6 @@ &reftitle.errors; - &csprng.errors; If offset is greater than the length of From bf61b486b42f9c80d086e6998a52e6c9f4f2667c Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Tue, 28 Oct 2025 16:38:45 +0000 Subject: [PATCH 8/9] Add invalid offset ValueError information to strrpos-related methods --- reference/mbstring/functions/mb-strripos.xml | 14 +++++++++----- reference/mbstring/functions/mb-strrpos.xml | 13 +++++++++++++ reference/strings/functions/strripos.xml | 13 +++++++++++++ reference/strings/functions/strrpos.xml | 13 +++++++++++++ 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/reference/mbstring/functions/mb-strripos.xml b/reference/mbstring/functions/mb-strripos.xml index bc4d24e0804d..2f4ae89dc2c2 100644 --- a/reference/mbstring/functions/mb-strripos.xml +++ b/reference/mbstring/functions/mb-strripos.xml @@ -78,14 +78,18 @@ - &reftitle.changelog; diff --git a/reference/mbstring/functions/mb-strrpos.xml b/reference/mbstring/functions/mb-strrpos.xml index cc7fee43fec5..fed93bfa031d 100644 --- a/reference/mbstring/functions/mb-strrpos.xml +++ b/reference/mbstring/functions/mb-strrpos.xml @@ -76,6 +76,19 @@ + + &reftitle.errors; + + + + If offset is greater than the length of + haystack, a + ValueError will be thrown. + + + + + &reftitle.changelog; diff --git a/reference/strings/functions/strripos.xml b/reference/strings/functions/strripos.xml index 9703513145f3..3b069b67eb14 100644 --- a/reference/strings/functions/strripos.xml +++ b/reference/strings/functions/strripos.xml @@ -90,6 +90,19 @@ &return.falseproblem; + + &reftitle.errors; + + + + If offset is greater than the length of + haystack, a + ValueError will be thrown. + + + + + &reftitle.changelog; diff --git a/reference/strings/functions/strrpos.xml b/reference/strings/functions/strrpos.xml index b2b022aa9986..92b3553d7802 100644 --- a/reference/strings/functions/strrpos.xml +++ b/reference/strings/functions/strrpos.xml @@ -86,6 +86,19 @@ &return.falseproblem; + + &reftitle.errors; + + + + If offset is greater than the length of + haystack, a + ValueError will be thrown. + + + + + &reftitle.changelog; From 223c47f09b7856735c254341c59d5454d6e1fc1d Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Tue, 28 Oct 2025 16:52:28 +0000 Subject: [PATCH 9/9] Fix whitespace for strprpos error message info --- reference/mbstring/functions/mb-strrpos.xml | 22 ++++++++++----------- reference/strings/functions/strrpos.xml | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/reference/mbstring/functions/mb-strrpos.xml b/reference/mbstring/functions/mb-strrpos.xml index fed93bfa031d..656a4d7b0601 100644 --- a/reference/mbstring/functions/mb-strrpos.xml +++ b/reference/mbstring/functions/mb-strrpos.xml @@ -76,19 +76,19 @@ - + &reftitle.errors; - - - If offset is greater than the length of - haystack, a - ValueError will be thrown. - - - - - + + + If offset is greater than the length of + haystack, a + ValueError will be thrown. + + + + + &reftitle.changelog; diff --git a/reference/strings/functions/strrpos.xml b/reference/strings/functions/strrpos.xml index 92b3553d7802..2ec4dba9a261 100644 --- a/reference/strings/functions/strrpos.xml +++ b/reference/strings/functions/strrpos.xml @@ -86,7 +86,7 @@ &return.falseproblem; - + &reftitle.errors; @@ -98,7 +98,7 @@ - + &reftitle.changelog;