#27881 closed enhancement (fixed)
Compatibility with Hack
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.0 | Priority: | normal |
| Severity: | normal | Version: | 4.0 |
| Component: | General | Keywords: | |
| Focuses: | Cc: |
Description
We should make sure WordPress is compatible with Hack and can safely (still) run on HHVM.
Attachments (13)
Change History (105)
#3
@
12 years ago
- Keywords needs-patch added
- Milestone changed from Future Release to 4.0
First gonna focus on variable-variables
#4
@
12 years ago
media-27881.2.diff ditches variable variables and extract() in playlist, audio, and video shortcodes.
#6
@
12 years ago
Added patches to ditch variable variables in wp_salt(), plugins_url(), wp-admin/includes/menu.php, wp_reset_vars()
#7
@
12 years ago
HHVM ships with a tool called hackificator that analyzes your files and automatically converts them to Hack <?hh or complains. Most of the tools only run on Debian/Linux, so you have to run them in the cloud or a VM using Vagrant.
There are some subtle things Hack complains about. Some are harmless little style fixes. It really hates global scope. I will address the things which don't require a huge refactor first. Some of the refactor items might not be worth the churn, some we won't touch at all.
#16
@
12 years ago
So... been reading more and more.... there are a bunch of things we can't change, but some of these fixes are valid anyways and will at least get us closer.
HHVM can run Hack and PHP, doesn't all have to be Hack-compatible.
A list of things you can't do in Hack: http://docs.hhvm.com/manual/en/hack.unsupported.php
#29
in reply to:
↑ 10
@
12 years ago
Replying to wonderboymusic:
In 28479:
We should codify this as a coding standard to ensure we're consistent in the future; we haven't been in the past:
$ ~/bin/ack '^\s*(include|require)(_once)? .*;' | wc -l
101
$ ~/bin/ack '^\s*(include|require)(_once)\s*\(.*;' | wc -l
294
#54
@
12 years ago
Here are some issues to look at, might not all be valid, but is the remaining actionable output from hackificator:
wp-admin/includes/class-wp-filesystem-base.php:357:19,26: The method getchmod is undefined in an object of type WP_Filesystem_Base ... wp-admin/includes/class-wp-filesystem-base.php:14:7,24: Check this out
wp-admin/includes/class-wp-filesystem-direct.php:24:18,28: You are extending a class that needs to be initialized
Make sure you call parent::__construct.
wp-admin/includes/class-wp-filesystem-ftpsockets.php:22:18,28: You are extending a class that needs to be initialized
Make sure you call parent::__construct.
wp-admin/includes/class-wp-filesystem-ssh2.php:44:18,28: You are extending a class that needs to be initialized
Make sure you call parent::__construct.
wp-admin/includes/class-wp-upgrader-skins.php:28:31,31: Don't use references!
wp-admin/includes/class-wp-upgrader-skins.php:702:11,17: The member options is undefined in an object of type Automatic_Upgrader_Skin
wp-admin/includes/class-wp-upgrader-skins.php:697:7,29: Check this out
wp-admin/includes/class-wp-users-list-table.php:388:5,8: Expected modifier
wp-admin/includes/deprecated.php:341:2,4: Expected modifier
wp-admin/includes/list-table.php:90:18,38: This is a dangerous method name, if you want to define a constructor, use __construct
wp-admin/includes/revision.php:176:35,47: The variable $restore_link is defined
wp-admin/includes/revision.php:135:4,16: But in a different scope)
wp-admin/includes/template.php:38:29,29: Don't use references!
wp-admin/options.php:235:12,12: Expected attribute value
wp-admin/plugin-editor.php:235:224,224: Expected ul
wp-admin/update-core.php:613:20,20: Expected attribute value
wp-includes/bookmark-template.php:246:21,25: The variable $cats is defined
wp-includes/bookmark-template.php:231:3,7: But in a different scope
wp-includes/capabilities.php:307:2,4: Expected modifier
wp-includes/category.php:344:28,28: Don't use references!
wp-includes/class-oembed.php:181:66,71: Undefined variable: $links
wp-includes/class-wp-customize-setting.php:392:45,45: Don't use references!
wp-includes/class-wp-image-editor.php:277:22,34: The method get_extension is undefined in an object of type WP_Image_Editor
wp-includes/class-wp-image-editor.php:14:16,30: Check this out
wp-includes/class-wp-walker.php:100:29,29: Don't use references!
wp-includes/class-wp-walker.php:333:12,21: The variable $total_top is defined
wp-includes/class-wp-walker.php:327:4,13: But in a different scope
wp-includes/class-wp-xmlrpc-server.php:265:26,26: Don't use references!
wp-includes/class.wp-dependencies.php:122:10,42: Too many arguments
wp-includes/class.wp-scripts.php:172:15,20: The variable $after is defined
wp-includes/class.wp-scripts.php:159:4,9: But in a different scope
wp-includes/cron.php:327:10,10: Yeah...we're not going to support continue/break N. It makes static analysis tricky and it's not really essential)
wp-includes/date.php:108:2,9: Expected modifier
wp-includes/default-widgets.php:16:2,9: Expected modifier
wp-includes/class.wp-styles.php:87:10,146: Too many arguments
wp-includes/plugin.php:156:10,22: Definition is here
wp-includes/query.php:3425:2,9: Expected modifier
wp-includes/revision.php:289:31,31: Don't use references!
wp-includes/rewrite.php:428:2,4: Expected modifier
wp-includes/script-loader.php:50:30,30: Don't use references!
wp-includes/user.php:452:2,4: Expected modifier
wp/wp-includes/widgets.php:26:2,4: Expected modifier
wp-includes/wp-db.php:64:2,4: Expected modifier
wp-includes/wp-diff.php:34:2,4: Expected modifier
This ticket was mentioned in IRC in #wordpress-dev by wonderboymusic. View the logs.
12 years ago
#79
@
12 years ago
- Keywords needs-patch removed
- Resolution set to fixed
- Status changed from new to closed
Got rid of extract() and variable variables ($$name). Added access modifiers to classes. Fixed some PHP class definitions. Eradicated a lot of mixed quote styles in HTML.
We are nowhere near close to being 100% compatible with Hack. Hack doesn't support global scope!
Cleaned up a lot. Done for now.
#80
@
12 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
27881.opml.diff (untested) removes obsolete globals from docs. $opml_map and $map seem to be unused after [28743].
#81
@
12 years ago
Looks like the logic in r28734 has changed. $$input used sanitized variables which contained actual values, unlike $inputs[$input] which in that context contains data about which input fields are hidden. See 27881.diff.
#82
@
12 years ago
In r28736 the isset() logic seems to be redundant, it will return true for everything because all the variables are defined at one point or another.
This is going to be difficult as we use extract() to pull globals into the current (but not global) namespace during template loading. But we could at least get it really close by eliminating unnecessary uses of extract() (there is another ticket for this) and variable-variables, because both are pretty lame.