File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1495,11 +1495,17 @@ private function skip_script_data(): bool {
1495
1495
1496
1496
while ( false !== $ at && $ at < $ doc_length ) {
1497
1497
$ at += strcspn ( $ html , '-< ' , $ at );
1498
+
1498
1499
/*
1499
1500
* Ultimately a SCRIPT closer (`</script>`) must be found or this function will
1500
- * return false.
1501
- * `</script` is the longest sequence that can be matched, so subsequent length checks
1502
- * are redundant.
1501
+ * return false. This removes the need for additional length checks and allows
1502
+ * for an early return if it's impossible to find a closer.
1503
+ *
1504
+ * $at is potentially here
1505
+ * ↓
1506
+ * </script>
1507
+ * ╰──┬───╯
1508
+ * $at + 8 additional characters is the minimum length required to skip script data.
1503
1509
*/
1504
1510
if ( $ at + 8 >= $ doc_length ) {
1505
1511
return false ;
You can’t perform that action at this time.
0 commit comments