Opened 8 years ago
Closed 8 years ago
#42396 closed defect (bug) (invalid)
question about wp_kses - is that correct?
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | General | Keywords: | |
| Focuses: | Cc: |
Description
wp-includes\kses.php, there is:
function wp_kses_split( $string, $allowed_html, $allowed_protocols ) {
global $pass_allowed_html, $pass_allowed_protocols;
$pass_allowed_html = $allowed_html;
$pass_allowed_protocols = $allowed_protocols;
return preg_replace_callback( '%(<!--.*?(-->|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $string );
}
before the return, there are variables, which are not used anywhere inside that function, is that correct?
Change History (3)
#1
@
8 years ago
Version 0, edited 8 years ago
by
(next)
#2
@
8 years ago
- Keywords close added
before the return, there are variables, which are not used anywhere inside that function, is that correct?
No.
global $pass_allowed_html, $pass_allowed_protocols; $pass_allowed_html = $allowed_html; $pass_allowed_protocols = $allowed_protocols;
This means the two global variables are overridden by the function arguments. _wp_kses_split_callback uses these globals after that.
doesn't that make an infinite loop?
No. wp_kses() might get called multiple times, that's called recursion. That doesn't automatically make it an infinite loop though.
Note: See
TracTickets for help on using
tickets.
also, my another question, i see some strange cycle:
wp_ksescallswp_kses_splitfunction wp_kses( .... return wp_kses_split(.....) )wp_kses_splititself, calls_wp_kses_split_callbackfunction wp_kses_split( $string, $allowed_html, $allowed_protocols ) { ....... return preg_replace_callback(..........., '_wp_kses_split_callback', .......); }_wp_kses_split_callbackcallswp_kses_split2function _wp_kses_split_callback( $match ) { ........ return wp_kses_split2(......); }function wp_kses_split2($string, $allowed_html, $allowed_protocols) { ....... while ( $string != ($newstring = wp_kses(..........)) ) ..... }doesnt that make an infinite loop?