WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #24493, comment 3


Ignore:
Timestamp:
06/05/13 22:41:21 (21 months ago)
Author:
nofearinc
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24493, comment 3

    initial v1  
    33There is a problem with the base_id while fetching widgets. In `wp-includes/widgets.php` the `update_callback` function is fetching the **$settings** array as an array with a single element (the widget ID) for Chrome and 2 elements (widget ID + the literal `__i__`) on Firefox. 
    44 
    5 The `__i__` literal is set to widgets when the widget number is equal to -1 (to avoid bad referencing for non-existing widget ID). `wp-admin/js/widgets.js` is calling some replace functions over __i__ and it is probably not handled correctly (maybe order of operations issue for non-Webkit as widgets being saved before widget ID has been initialized). Still looking at it, but apparently the __i__ string is causing a second array to be fetched in `widgets.php` where one of the values is stored there instead of in the original widget ID referred array. 
     5The `__i__` literal is set to widgets when the widget number is equal to -1 (to avoid bad referencing for non-existing widget ID). `wp-admin/js/widgets.js` is calling some replace functions over __i__ and it is probably not handled correctly (maybe order of operations issue for non-WebKit as widgets being saved before widget ID has been initialized). Still looking at it, but apparently the __i__ string is causing a second array to be fetched in `widgets.php` where one of the values is stored there instead of in the original widget ID referred array. 
     6 
     7Edit: The problem is in widgets.js, this line in particular: 
     8 
     9 
     10{{{ 
     11ui.item.html( ui.item.html().replace(/<[^<>]+>/g, function(m){ return m.replace(/__i__|%i%/g, n); }) ); 
     12}}} 
     13 
     14It seems to properly recognize tags in WebKit but fails in FF/IE and one of the inputs is left with __i__ instead of replaced by widget ID. Therefore the data is not passed properly in the array and not stored into the DB. 
     15 
     16I'm not sure if that's an accepted use case for input data at the first place, otherwise I would think of a way to explicitly convert < and > characters into lt/gt or other format to unify them as to how WebKit understands them so that the regex works (or think of another regex that would work for all engines).