Skip to content

Fixes towards PHP8 and type-hinting#47

Closed
Quix0r wants to merge 7 commits into
PHProxy:masterfrom
Quix0r:master
Closed

Fixes towards PHP8 and type-hinting#47
Quix0r wants to merge 7 commits into
PHProxy:masterfrom
Quix0r:master

Conversation

@Quix0r
Copy link
Copy Markdown
Contributor

@Quix0r Quix0r commented Nov 21, 2025

This PR contains changes towards PHP8 compatibility:

  • Function each() is no longer available, also checking an assignment of a value/reference should not be done anymore
  • added many type-hints
  • Used "new" way []for arrays instead ofarray()`
  • Arrays now nicer formatted

- <include|require[_once]> are no functions, they are keywords, so don't use
  braces () to make them look like functions
- converted old-style array() initialization into "new" [] way
- added primitive type-hints
- changed {} into [] braces
- removed get_magic_quotes_gpc() as it has been removed, maybe sanitizing your
  input is a bad idea
- PHP function `each()` is outdated, also an `if ($foo = bar())` should not be
  done anymore
- type-hints added
@miglen
Copy link
Copy Markdown
Member

miglen commented May 27, 2026

Thanks for the substantial work here, @Quix0r — this PR was applied as the base of #48 (PHP 8.5 modernization) with credit as a co-author. Two small follow-ups were layered on top: the each() replacement had a $dummy / $_dummy typo that prevented it running, and PHP 8.4/8.5 needed ?string nullable param types in set_post_vars / set_post_files. All shipped on master. Closing in favor of #48.

@miglen miglen closed this May 27, 2026
Quix0r added a commit to Quix0r/phproxy that referenced this pull request May 27, 2026
Modernizes PHProxy to run on PHP 8.5 and ships a first-class Docker
install option. Closes the PHP-8 issue bucket (PHProxy#25, PHProxy#32, PHProxy#38, PHProxy#43, PHProxy#46).

PHP 8.5 fixes:
- Drop removed get_magic_quotes_gpc(); set stripslashes flag to false
- Replace $_iflags{$i} / $dir{$i} curly-brace string offsets with []
- Replace each($_auth_creds) with array_key_first()-based lookup
- Guard $_COOKIE['userAgent'] with isset()
- Cast trim() inputs for HTTP_REFERER, response headers, cookie domain
- ?string nullable params (8.4 deprecation, 8.5 error-on-deprecate)
- intdiv() in Punycode loop (no more float-to-int deprecations)
- Drop E_STRICT (removed in 8.4)

Modernization (from PR PHProxy#47):
- Type hints across files/php/functions.inc.php
- Short [] array syntax throughout

Docker (new):
- Dockerfile based on php:8.5-apache, mod_rewrite enabled
- docker-compose.yml with dev bind-mount and a prod-mode note
- .dockerignore

CI (new):
- .github/workflows/lint.yml runs php -l on every *.php
  in php:8.1-cli and php:8.5-cli containers

README:
- Docker quickstart added above standalone install
- PHP requirement bumped to >= 8.1, tested on 8.5
- Modern-site limitation documented (CF/JS-gated sites won't work)

Co-Authored-By: Roland Häder (Quix0r) <Quix0r@users.noreply.github.com>
Co-Authored-By: dacendo <dacendo@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants