Posted by pwolanin on February 16, 2008 at 6:08pm
| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | javascript |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Since we require PHP 5.2, we can rely instead on the built-in function json_encode()
http://www.php.net/manual/en/function.json-encode.php
Someone who knows more about the AHAH functionality should look at this- - also this change seem to break upload module's attach button, which suggests that there is some difference between the output of drupal_to_js() and json_encode()
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| remove-drupal_to_js.patch | 5.19 KB | Ignored: Check issue status. | None | None |
Comments
#1
Ahh - investigation reveals that json_encode() does not escape < > or & the way drupal_to_js() does - thus there are HTML errors when the AHAH tries to get the updated form.
#2
new patch - leave drupal_to_js() so we can escape to HTML-safe, but use the built-in json_encode() for efficiency.
With this the upload form AHAH, at least, seems to work right.
#3
Subscribing. Looking good! :)
#4
tested with PHP 5.2.4, Mac 10.4, FF 2.0 and Safari 3.0, apache 1.3:
book, upload, poll module AHA all works fine, user autocomplete field in node form works fine.
#5
Tested also in ie6 and ie7. Poll, book, upload and autocomplete all work.
#6
I committed this to CVS HEAD. Thanks.
#7
Note: I asked Steven about why he introduced the escaping in the first place, since everything seems to work fine without. The reason he put that into place is because it was required for the upload.module's iframe mechanism. This however, has been removed (and replaced with AHAH). That means, that we can get rid of the encoding after we tested that everything still works.
#8
@kk - during my testing it did NOT work when the escaping was removed. See the first patch.
#9
back to fixed
#10
Automatically closed -- issue fixed for two weeks with no activity.
#11
Does this need backporting to d6 (in order to help with upgrade to jQuery 1.4.x)?
PS: Changed status in order to gain some attention - don't mean to bust anyone's b@lls here. Feel free to change back if it is irrelevant, but it does seem to solve this #818138: jQuery 1.4.x compatibility in Hierarchical Select.
#12
I think this is closed in terms of core, certainly for Drupal 6.x.
#13
Care to explain why Peter? Is it because d7 requires php 5.2 (that has json_encode() built-in) while d6 requires 4.4+ instead? If so, I think there could be a check to detect php version and then if >5.2 use json_encode(), if <5.2 use drupal_to_js().