[wp-trac] [WordPress Trac] #30779: Call to undefined function wp_json_encode()

WordPress Trac noreply at wordpress.org
Sat Dec 20 01:28:17 UTC 2014


#30779: Call to undefined function wp_json_encode()
--------------------------+------------------------------
 Reporter:  pento         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  high          |   Milestone:  Awaiting Review
Component:  General       |     Version:  4.1
 Severity:  major         |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by dd32):

 Replying to [comment:1 azaozz]:
 > This may happen because `class.wp-scripts.php` is included from `script-
 loader.php`

 I don't think this is the case.

 The only use (and the error here) is from the localize script printer,
 which should never be hit on those requests.
 It's worth mentioning that `load-(scripts|styles).php`  does include a no-
 op `json_encode()` compat method that should be altered to
 `wp_json_encode()` though.

 I suspect this may be from an install on which `wp-includes/functions.php`
 didn't get updated, there's a handful of cases every release where similar
 issues happen.
 My reasoning is:
  - Only three locations include `script-loader.php`, those are: `wp-
 load.php`, `wp-admin/load-styles.php`, `wp-admin/load-scripts.php`
  - `wp-admin/load-styles.php` & `wp-admin/load-scripts.php` won't call
 `wp_json_encode()`
  - `wp-load.php` includes `wp-includes/functions.php` on line 72, and `wp-
 includes/script-loader.php` on line 143, so `wp_json_encode()` should
 always be loaded.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30779#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list