1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00
Commit Graph

36 Commits

Author SHA1 Message Date
Andreas Möller
d9bcfed482 Enhancement: Enable array_syntax fixer
Co-authored-by: MathiasReker <mathias@reker.dk>

Closes GH-659.
2022-08-22 18:59:14 +02:00
Christoph M. Becker
5c9eab2f38 Fix CS violations (case of null, false and true) 2022-07-15 14:05:50 +02:00
Andreas Möller
b575ebd409 Enhancement: Include *.inc files (with exceptions)
Closes GH-662.
2022-07-15 13:57:08 +02:00
Ayesh Karunaratne
1b83fd7ab7 Multiple micro-optimizations
* Replace `ob_get_contents();ob_clean()` with `ob_get_clean()`

`ob_get_clean()` is equivalent to `ob_get_contents()` followed by `ob_clean()`.

* Replace `intval()` calls with `(int)` type cast

This is a micro-optimization because `intval()` is a function call, and the type cast is about 6 times fast.

* Replace `preg_replace` call that could be done with an `rtrim()` call

In `./error.php`, there is a `preg_replace('!/+$!', '', $URI);` call that essentially is equivalent to `rtrim()`, that both calls removing trailing slash characters in `$URI`.
The `rtim()` call is more legible and faster.

* Combine consecutive `str_replace` calls to a single `str_replace` call

* Use short ternary operator where possible

Improves code readability.

* Cascade various `else` statements where possible

Cleans up the code by removing unnecessary `else` blocks and moving the code to the parent context if the previous `if` block exits the function by either terminating the script, or with a `return` statement.

* Combine multiple `isset()` calls to a single `isset()`

`isset()` accepts multiple parameters and returns `true` only if all of the parameters are `isset`. It makes sense to combine multiple individual `isset` calls to a single call for better readability.

* Replace `for` loop with a `foreach` loop

* Remove unnecessary character escapes in regular expressions

Regular expression special characters are context-sensitive. For example, special characters such as `.` are not considered special within square braces (`[]`).
This removes several of such instances that certain characters are escaped, but it is not strictly necessary within the context. This improves the readability of the expression.

See more information at [PHP.Watch: Writing better Regular Expressions in PHP](https://php.watch/articles/php-regex-readability#reduce-escape)

* Remove unnecessary break statement

* Remove unnecessary PHP close tags

* Remove redundant JSON_ERROR_NONE check

Remove unnecessary `json_last_error() == JSON_ERROR_NONE` where the decoded object is inspected already.

Closes GH-603.
2022-07-03 12:24:14 +02:00
Andreas Möller
c6fecd8529 Fix: Add type and return type declaration (#587) 2022-06-28 22:13:58 +01:00
Andreas Möller
1e7a49e268 Fix: Remove unused local variables
Closes GH-578.
2022-06-28 15:25:35 +02:00
Kamil Tekiela
fa3391b9dc Refactor compare_version function (#568) 2022-06-28 11:30:39 +01:00
Sara Golemon
527e1f4a06 Guard against security eol date not found 2021-01-07 18:15:50 +00:00
Sara Golemon
576f18a126 Move recent release finding logic to branches.icn, clean up bumpRelease 2019-07-09 22:56:50 -04:00
Sara Golemon
2735e5f03f Swap uses of _SERVER[DOCUMENT_ROOT] for __DIR__
1/n - Update / and /include/ only.
2019-05-31 11:19:09 -04:00
Christoph M. Becker
d160aebe33 Fix 7.0 EOL dates 2019-01-31 13:50:13 +01:00
Derick Rethans
09f261e364 Change to use "midnight" 2018-12-02 19:34:56 +01:00
Derick Rethans
5e802342f3 Fix off by-one error. Today (Dec 2nd), it shows 'today', where it's really the last day. 2018-12-02 19:34:56 +01:00
zrhoffman
b7231b60cd Fix #72707: Filter releases by minor version
- Rewrite version-specific part of releases API to loop over releases
  only once
- Releases API: filter by minor or patch version, if provided
- Remove unused variable
- Rewrite version_array() to use array_pad(). Intended behavior:
  - If count($versionArray) is less than $length, version_array()
    should pad it with 0s to $length.
  - If count($versionArray) is greater than $length, version_array()
    should slice it to $length.
  - If $length is not set, leave $versionArray as-is after exploding it.
- Remove unused variable
- Still print "Unknown version" if the major version is found but the
  minor or patch version is not.
- Remove excess white space
- Bind array_replace_recursive() result to new variable instead of
  mutating $RELEASES global
- Only set $machineReadable to its first element if $machineReadable is
  not empty.
2018-11-17 06:20:55 +01:00
Peter Kokot
e235f79473 Trim trailing whitespace
This patch cleans all redundant trailing whitespace across the
repository except for the icalendar files.
2018-10-17 10:51:08 +02:00
Adam Harvey
9840594811 Tweak the 5.6 EOL date to match the 5.6.30 release. 2017-01-20 10:36:29 +11:00
Rasmus Lerdorf
252be3c2f0 Avoid wrnings in case we can't get the active branches for some reason 2016-08-04 20:52:37 -07:00
Adam Harvey
445ecce8db Don't show recently EOLed branches in the supported versions table.
Changed the behaviour of get_active_branches() so that callers can
choose whether to get recently EOLed branches or not. (This is basically
for the supported versions page; the other callers -- namely the front
page download links and bug tracker backend -- likely still want the
previous behaviour.)

After all, it's a little weird listing 5.5 as a supported version in the
table when we just made a big deal of EOLing it!
2016-07-22 12:40:30 -07:00
Adam Harvey
695ec0732d Remove the "eol" hackery that I added a couple of years ago.
For "modern" PHP branches (5.3 onwards), we'll base whether they're considered
active purely off the support dates for the branch. To ensure that we don't
immediately remove the download links for EOL branches from the front page,
we'll still consider them "active" for those purposes for 28 days after the
final release.

Basically, rather than having two sources of truth for whether a branch is EOL
or not (the flag and the support dates in branches.inc), we now have one (the
support dates). This should be an improvement.
2016-07-20 19:20:58 -07:00
Adam Harvey
f02b126d48 Bump 5.5's EOL date to reflect tomorrow's release. 2016-07-20 17:52:50 -07:00
Sebastian Bergmann
75b9b2254d Reflect the vote on https://wiki.php.net/rfc/php56timeline 2016-01-13 13:11:44 +01:00
Adam Harvey
4ec6c1f342 Sort minor branches too. 2015-12-03 13:56:05 -08:00
Adam Harvey
2c6315e737 Ensure .0 releases get a date in the same place as old releases. 2015-12-03 12:34:45 -08:00
Adam Harvey
c36c03273c Ensure correct sorting of branches. 2015-12-03 12:32:27 -08:00
Adam Harvey
75e418c468 Good night and good luck, PHP 5.4. 2015-11-08 15:59:36 +01:00
Adam Harvey
c234285148 Add 5.5 EOL date block, per internals. 2015-06-24 10:03:19 -07:00
Adam Harvey
464ffa5497 Add a more generic ability to override support dates. 2014-10-27 15:16:39 -07:00
Adam Harvey
f1a3ca46cc Add a draft supported versions page, as suggested on Internals. 2014-10-27 13:25:21 -07:00
Adam Harvey
06658b4306 Tidy up the EOL page and move interval formatting to an include file. 2014-10-27 13:25:21 -07:00
Adam Harvey
5d0d7f3bfc It would be nice to have the actual version number, too. 2014-09-30 17:13:01 -07:00
Adam Harvey
6719d065bb Use the new eol flag for an active release JSON feed.
This is mostly useful so the bug tracker can still get a list of active
releases when the QA site is down (cough, cough).
2014-09-30 17:08:52 -07:00
Adam Harvey
295c61015c Remove the eol.php special case for 5.3.29.
Instead, let's have an optional "eol" flag for releases in the $RELEASES array,
and use that to drive eol.php.
2014-09-30 17:07:55 -07:00
Adam Harvey
c6f06a34aa Ensure we always link to the right downloads page. 2014-08-19 15:08:25 -07:00
Adam Harvey
d82c8f6ed3 Allow branches to be specified as "EOL" even if they're still in $RELEASES. 2014-08-19 15:02:09 -07:00
Adam Harvey
00dc07a0bf Fix a long standing bug: sort the actual branch array, not a copy of it. 2014-08-19 15:01:22 -07:00
Adam Harvey
87df5451ed Add a rough EOL page, per the Internals discussion. Copy editing welcome!
I haven't linked this from anywhere yet, pending further discussion.
2012-08-02 14:31:31 +08:00