#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.
Commits (78)
- [28342]
audio
,video
, andplaylist
shortcodes:… by @wonderboymusic 11 years ago - [28477] The About page has a
<div>
that doesn't close. Also,<hr>
s should self-close.hackificator
complains about these things.… by @wonderboymusic 11 years ago - [28478] Because the
WP_ADMIN
constant name can be bound in multiple files, all instances should check! defined
first.wp-admin/admin.php
already has this check. … by @wonderboymusic 11 years ago - [28479]
hackificator
complains if you callinclude 'file.php'
without the parens, needs to beinclude( 'file.php' )
… by @wonderboymusic 11 years ago - [28480] Add a unit test that demonstrates a magic getter.… by @wonderboymusic 11 years ago
- [28481] Use proper access modifiers and add a magic
__get()
method toCustom_Background
andCustom_Image_Header
.… by @wonderboymusic 11 years ago - [28482]
hackificator
bails on this file because the<meta>
isn't self-closing.… by @wonderboymusic 11 years ago - [28484]
hackificator
bails on this file because of mixed quote styles on some HTML attributes.… by @wonderboymusic 11 years ago - [28485] In
edit-link-form.php
,hackificator
bails because there is a</form>
with no open<form>
. It exists, but is needlessly constructed with PHP. It always returns a<form>
, only theid
andname
are different. The dynamic piece just returns the ID now.… by @wonderboymusic 11 years ago - [28486] Add access modifier (
public
) to members and methods inWP_Comments_List_Table
andWP_Post_Comments_List_Table
.… by @wonderboymusic 11 years ago - [28487] Add access modifiers to members and methods in
WP_Filesystem_Base
. Add magic__get()
method for backwards compatibility.… by @wonderboymusic 11 years ago - [28488] Add access modifier (
public
) to methods inWP_Filesystem_Direct
.… by @wonderboymusic 11 years ago - [28489] Add access modifier (
public
) to members and methods inWP_Filesystem_FTPext
.… by @wonderboymusic 11 years ago - [28490] Add access modifier (
public
) to members and methods inWP_Filesystem_ftpsockets
.… by @wonderboymusic 11 years ago - [28491] Add access modifier (
public
) to members and methods inWP_Filesystem_SSH2
.… by @wonderboymusic 11 years ago - [28492] Add access modifier (
public
) to methods inWP_Importer
.… by @wonderboymusic 11 years ago - [28493] Add access modifiers to methods and members of list table classes:… by @wonderboymusic 11 years ago
- [28494] Add access modifiers to methods and members of
WP_Users_List_Table
.… by @wonderboymusic 11 years ago - [28495] Add access modifier (
public
) to methods and members ofWP_Upgrader_Skin
and its subclasses.… by @wonderboymusic 11 years ago - [28496] Add access modifier (
public
) to methods and members ofWP_Upgrader
and its subclasses.… by @wonderboymusic 11 years ago - [28497]
hackificator
doesn't like mixed quote styles in some generated HTML. The switch from single to double allows these files to be parsed.… by @wonderboymusic 11 years ago - [28500] Fix some
hackificator
odds and ends inwp-admin
:… by @wonderboymusic 11 years ago - [28502] Add access modifiers to methods/members in
WP_Object_Cache
. Add a magic__get()
method for BC.… by @wonderboymusic 11 years ago - [28503] Add access modifiers to methods/members in
WP_Roles
. Add a magic__call()
method for BC.… by @wonderboymusic 11 years ago - [28504] Add access modifiers to methods/members in
Walker_Category
andWalker_CategoryDropdown
.… by @wonderboymusic 11 years ago - [28505] Add access modifiers to methods/members in
WP_Feed_Cache
,WP_SimplePie_File
, andWP_Feed_Cache_Transient
.… by @wonderboymusic 11 years ago - [28506] Add access modifier to methods of HTTP classes. There are no new private or protected methods, so no need for
__call()
.… by @wonderboymusic 11 years ago - [28507] Add access modifier to methods/members in
WP_oEmbed
. Adds a magic__call()
method for BC.… by @wonderboymusic 11 years ago - [28508] Add access modifier to methods/members in
WP_Ajax_Response
. Adds a magic__get()
method for BC.… by @wonderboymusic 11 years ago - [28509] Add missing access modifiers to methods/members in
WP_Customize_*
.… by @wonderboymusic 11 years ago - [28510] Add access modifiers to methods/members in
WP_Embed
.… by @wonderboymusic 11 years ago - [28511] Add access modifiers to methods/members in
WP_Error
. Add a magic__get()
method for BC.… by @wonderboymusic 11 years ago - [28512] Add access modifiers to methods/members in
WP_HTTP_IXR_Client
.… by @wonderboymusic 11 years ago - [28513] Add missing access modifiers to methods/members in
WP_Image_Editor_*
classes.… by @wonderboymusic 11 years ago - [28514] Add missing access modifiers to methods/members in
Walker
and subclasses. Add a magic__get()
method.… by @wonderboymusic 11 years ago - [28515] Add missing access modifiers to methods in
wp_xmlrpc_server
. Add a magic__call()
method for BC.… by @wonderboymusic 11 years ago - [28516] Add missing access modifiers to methods in
WP
andWP_MatchesMapRegex
. Add magic__call()
and__get()
methods toWP_MatchesMapRegex
for BC.… by @wonderboymusic 11 years ago - [28517] Add missing access modifiers to methods in
WP_Dependencies
and_WP_Dependency
.… by @wonderboymusic 11 years ago - [28518] Add missing access modifiers to methods in
WP_Scripts
andWP_Styles
.… by @wonderboymusic 11 years ago - [28519] Add missing access modifiers to methods in
WP_Comment_Query
. Add a magic__call()
method for BC.… by @wonderboymusic 11 years ago - [28520] Fix fatal error in unit test.… by @wonderboymusic 11 years ago
- [28521] Some classes with
__get()
method also need__set()
.… by @wonderboymusic 11 years ago - [28522] Add missing access modifiers to methods in
WP_Meta_Query
.… by @wonderboymusic 11 years ago - [28523] Add missing access modifiers to methods in
WP_Query
. Add magic methods for__get()
,__set()
,__isset()
,__unset()
, and__call()
.… by @wonderboymusic 11 years ago - [28524] Classes that have
__set()
also need__isset()
and__unset()
.… by @wonderboymusic 11 years ago - [28525] Add access modifiers to
WP_Text_Diff_Renderer_Table
that are compatible with its parent class. Some of the inline docs suggest access that, if implemented, would produce fatal errors.… by @wonderboymusic 11 years ago - [28526] In
wpdb
, make some things explicitlypublic
. Do not set anything toprivate
. This would instantly blow uphyperdb
in the wild.… by @wonderboymusic 11 years ago - [28527] Add
public
access modifier to methods/members ofWP_Widget
andWP_Widget_Factory
.… by @wonderboymusic 11 years ago - [28528] Add access modifiers to
WP_User_Query
.… by @wonderboymusic 11 years ago - [28529] In
WP_Filesystem_Base
, the constructor is a noop, so it shouldn't even be declared. Setting it implies thatparent::__construct()
should be called by its subclasses.… by @wonderboymusic 11 years ago - [28530]
hackificator
doesn't like mixed single/double-quoted attributes. These were 2 lingering instances in the admin.… by @wonderboymusic 11 years ago - [28531] Upgrade
_WP_List_Table_Compat
to PHP5-style constructor.… by @wonderboymusic 11 years ago - [28532]
WP_Date_Query
was only missing one access modifier.… by @wonderboymusic 11 years ago - [28533]
WP_Query
was only missing one access modifier.… by @wonderboymusic 11 years ago - [28633] Cleanup for
switch
statements:… by @wonderboymusic 11 years ago - [28734] Don't use a variable variable in
wp_widget_rss_form()
. Sidenote: the logic to show hidden fields is bizarre - would result in duplicate fields.… by @wonderboymusic 11 years ago - [28736] Don't use variable variables in
get_terms()
.… by @wonderboymusic 11 years ago - [28737] Don't use variable variables in
WP_Query::get_posts()
.… by @wonderboymusic 11 years ago - [28738] Don't use variable variables in
WP_Comment_Query::query()
.… by @wonderboymusic 11 years ago - [28739] Don't use variable variables in
plugins_url()
.… by @wonderboymusic 11 years ago - [28740] Don't use variable variables in
wp_insert_user()
.
Add a local array,$meta
, to provide substantial disambiguation among variables. … by @wonderboymusic 11 years ago - [28741] Don't use variable variables in
wp_salt()
.… by @wonderboymusic 11 years ago - [28742] Don't use variable variables in
wp_dashboard_plugins_output()
. Variable variables aren't the worst thing about this function.… by @wonderboymusic 11 years ago - [28743] OPML:… by @wonderboymusic 11 years ago
- [28744] Don't use variable variables in
setup-config.php
(Step 2).
See #27881.… by @wonderboymusic 11 years ago - [28745] Don't use variable variables in
user-new.php
. Test by causing errors when creating a new user.… by @wonderboymusic 11 years ago - [28746] Don't use variable variables in
wp_reset_vars()
. Test by searching in list tables, etc.… by @wonderboymusic 11 years ago - [28747] Don't use variable variables in
touch_time()
.
See #27881.… by @wonderboymusic 11 years ago - [28786] Remove unused globals from
link-parse-opml.php
after [28743].… by @wonderboymusic 11 years ago - [28787] Cleanup
wp_widget_rss_form()
after [28734]. "$$input used sanitized variables which contained actual values, unlike $inputs[$input] which in that context contains data about which input fields are hidden."… by @wonderboymusic 11 years ago - [29139] Fill out inline documentation for magic methods added to the
WP_Text_Diff_Renderer_Table
class in [28525].… by @DrewAPicture 11 years ago - [29140] Fill out inline documentation for magic methods added to the
WP_User_Query
class in [28528].… by @DrewAPicture 11 years ago - [29141] Fill out inline documentation for magic methods added to the
WP_Query
class in [28523].… by @DrewAPicture 11 years ago - [29142] Fill out inline documentation for magic methods added to the
WP_MatchesMapRegex
class in [28516].… by @DrewAPicture 11 years ago - [29143] Fill out inline documentation for magic methods added to the
Walker
class in [28514].… by @DrewAPicture 11 years ago - [29144] Fill out inline documentation for magic methods added to the
WP_Error
class in [28511].… by @DrewAPicture 11 years ago - [29145] Fill out inline documentation for magic methods added to the
WP_Ajax_Response
class in [28524].… by @DrewAPicture 11 years ago - [29146] Fill out inline documentation for magic methods added to the
WP_Object_Cache
class in [28502], [28521], [28524].… by @DrewAPicture 11 years ago
Pull Requests
- Loading…
Change History (105)
#3
@ Emeritus Committer
11 years ago
- Keywords needs-patch added
- Milestone changed from Future Release to 4.0
First gonna focus on variable-variables
#4
@ Emeritus Committer
11 years ago
media-27881.2.diff ditches variable variables and extract()
in playlist, audio, and video shortcodes.
#6
@ Emeritus Committer
11 years ago
Added patches to ditch variable variables in wp_salt()
, plugins_url()
, wp-admin/includes/menu.php
, wp_reset_vars()
#7
@ Emeritus Committer
11 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
@ Emeritus Committer
11 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
@ Emeritus Committer
11 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
@ Emeritus Committer
11 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.
11 years ago
#79
@ Emeritus Committer
11 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
@ Core Committer
11 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
@ Emeritus Committer
11 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
@ Emeritus Committer
11 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.