#16918 closed task (blessed) (fixed)
Take out unnecessary compat functions from compat.php
Reported by: | markjaquith | Owned by: | |
---|---|---|---|
Milestone: | 3.2 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch dev-feedback |
Focuses: | Cc: |
Description
Now that we require PHP 5.2.4, let's take out anything in compat.php that is no longer necessary. If you'd like to tackle this, please say so. Please also verify for certain that the functions you're removing are present in ALL PHP 5.2.4 installs.
Attachments (9)
Change History (39)
#2
@
14 years ago
We should kill the file and the include. We know where to find the template for future functions.
Services_JSON can go too.
#3
@
14 years ago
ticket.16918.2.diff removes the compat.php file and replaces instances of _http_build_query() with http_build_query().
#5
@
14 years ago
Consolidated patch, another _http_build_query() was left in class-http.php (the only one I could find from the whole compat functions list), some references to said functions were left in comments.
#7
@
14 years ago
In #16932, looking into add_query_arg() and friends I've been running over _http_build_query() again.
In this ticket we said, it's compat to http_build_query(), but it's not. The $key parameter is undefined and the $urlencode parameter is undefined.
It looks like that _http_build_query() has been designed pre 5.3.6 (makes sense) and that it's overloading optional parameters that are now used in a different context and therefore render the compat function incompatible.
The udpated patch reflects that for that one call in build_query().
#8
follow-up:
↓ 9
@
14 years ago
The usage of _http_build_query() is clearly reliant on the requirement to not URL encode there.
#9
in reply to:
↑ 8
@
14 years ago
Replying to nacin:
The usage of _http_build_query() is clearly reliant on the requirement to not URL encode there.
Will provide a fix.
#11
@
14 years ago
Looks good. We should probably also deprecated _http_build_query() unfortunately.
#13
@
14 years ago
- Keywords dev-feedback added
Would love to keep the progress going. Some dev-feedback on _http_build_query() and wp_clone is appreciated.
#15
@
14 years ago
_http_build_query (from php.net manual) is reflected so far (thx ryan, Related: [17603]), wp_clone still pending (is less trivial than previous changes so very much OK).
however would like to see more traction which includes close (esp. in favor of #16920) of this ticket.
Subject to opinion (but?) I think this ticket can already considered closed [that's merely self-criticism].
Feedback appreciated.
#16
@
14 years ago
It looks like in doing this we removed _()
which is part of gettext right?If I'm reading this right gettext is optional. Should we be dropping _()
back into compat.php and putting it back? See: #17064
#17
@
14 years ago
mb_substr has now been removed, apparently, but mb_ functions are not a default in each PHP install, from http://php.net/manual/en/mbstring.installation.php :
"mbstring is a non-default extension. This means it is not enabled by default. You must explicitly enable the module with the configure option. See the Install section for details."
Please put it back as it was, as it was already throwing errors on yoast.com.
#18
@
14 years ago
I decided to double check everything:
http_build_query()
&_http_build_query()
can be removed: http://php.net/manual/en/url.installation.php_()
cannot be removed: http://php.net/manual/en/gettext.installation.phpstripos()
can be removed: http://php.net/manual/en/strings.installation.phphash_hmac()
&_hash_hmac()
can be removed: http://php.net/manual/en/hash.installation.phpmb_substr()
&_mb_substr()
cannot be removed: http://php.net/manual/en/mbstring.installation.phphtmlspecialchars_decode()
can be removed: http://php.net/manual/en/strings.installation.phpjson_encode()
&json_decode()
can be removed: http://php.net/manual/en/json.installation.phppathinfo52()
can be removed according to notes: http://php.net/manual/en/function.pathinfo.php
I don't see why we have _mb_substr()
so I combined it with mb_substr()
and made a new patch.
#22
@
13 years ago
- Resolution set to fixed
- Status changed from new to closed
I think we're done here.
#23
@
13 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Symptom: wordpress 3.2 post-install complains of missing 'hash_hmac' function
Environment: My host is running PHP 5.2.11-pl0-gentoo
Fix: restore hash_hmac to compat.php
#24
@
13 years ago
What host are you on? If they don't have hash_hmac it means they had to explicitly disable it by using the --disable-hash switch.
#25
@
13 years ago
- Resolution set to fixed
- Status changed from reopened to closed
PHP needs to be reemerged with USE=hash.
#26
follow-up:
↓ 28
@
13 years ago
Joyent Shared Hosting has PHP Version 5.2.12 (SunOS 5.11), but defaults to --disable-json so is missing json_encode() & json_decode() and that means image editor (backend) oembeds (front end) don't work and (WordPress.com JetPack is also broken).
http://oldwiki.joyent.com/shared:php?s[]=disable&s[]=json
I wonder how common this is. I'm contacting Joyent support to see if they will change their default.
#27
@
13 years ago
json.so can be enabled in the relevant php.ini file (~/etc/php5/php.ini or ~/domains/domain.name/etc/php5/php.ini). If it's enabled by default it would not be retroactive - will follow up tomorrow morning about this.
#28
in reply to:
↑ 26
;
follow-up:
↓ 29
@
13 years ago
Replying to lloydbudd:
I'm wondering what is the reason for disabling json. It seems we will be using it more and more, expecting other functions to be transferred to json in 3.3.
#29
in reply to:
↑ 28
;
follow-up:
↓ 30
@
13 years ago
Replying to azaozz:
Replying to lloydbudd:
I'm wondering what is the reason for disabling json. It seems we will be using it more and more, expecting other functions to be transferred to json in 3.3.
Joyent's support says it is an optimization to keep the php runtime unbloated.
Looks like it's coming back with #18015: Restore compat Services_JSON (class-json.php), json_encode, json_decode
Functions in compat.php
All of them can be removed. I left the file there but empty for future use. In addition, pathinfo52 can be updated to pathinfo where the PATHINFO_FILENAME constant was added used in wp-admin/includes/image-edit.php:554.