Skip to content

Upgrade PHP MapScript support for PHP 8.4 and 8.5#7435

Open
Giacomo92 wants to merge 12 commits into
MapServer:mainfrom
offline-agency:feat-upgrade-php-84-85
Open

Upgrade PHP MapScript support for PHP 8.4 and 8.5#7435
Giacomo92 wants to merge 12 commits into
MapServer:mainfrom
offline-agency:feat-upgrade-php-84-85

Conversation

@Giacomo92
Copy link
Copy Markdown

@Giacomo92 Giacomo92 commented Feb 15, 2026

Summary

  • Add PHP 8.4 and 8.5 compatibility to the MapServer PHP MapScript extension
  • Fix implicit nullable parameter deprecations and null pointer initialization in core objects (legend, web, reference, querymap)
  • Improve CMake PHP include path detection to support PHP 8.3/8.4/8.5 and various installation layouts
  • Add comprehensive PHP 8.4+ deprecation test suite (419 lines) covering object creation, method calls, query operations, and type handling
  • Update CI to build and test across 8.4, and 8.5, with PHPUnit 13 support
  • Add Dockerfile for reproducible local CI builds
  • Clean up generated files from version control and update .gitignore

@jmckenna jmckenna self-requested a review February 16, 2026 11:59
Comment thread CMakeLists.txt Outdated
option(WITH_GIF "Enable GIF support (for PIXMAP loading)" ON)
option(WITH_PYTHON "Enable Python mapscript support" OFF)
option(WITH_PHPNG "Enable PHPNG (SWIG) mapscript support" OFF)
option(WITH_PHPNG "Enable PHPNG (SWIG) mapscript support" ON)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dunno if that's desired, but that's a default change that can have consequences for downstreams/packagers, warrants a note in the changelog if kept

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Giacomo92 all mapscripts should be OFF by default

Comment thread ci/ubuntu/build.sh Outdated
elif [ ${PHPVersionMinor} -ge 83 ]; then
cd php && curl -LO https://phar.phpunit.de/phpunit-12.phar
echo "PHPUnit version"
php phpunit-12.phar --version
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't phpunit-13.phar and phpunit-12.phar be downloaded if 84?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Giacomo92 you have a conflict in this pull request, as last week's changes through #7426 handled PHP 8.4 and 8.5 (in other words, you should remove your proposed changes in build.sh)

Copy link
Copy Markdown
Member

@jmckenna jmckenna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Giacomo92 I think it would be good for you to update the description in this pull request, with the goals of this big pull request. thanks.

Comment thread ci/ubuntu/build.sh Outdated
elif [ ${PHPVersionMinor} -ge 83 ]; then
cd php && curl -LO https://phar.phpunit.de/phpunit-12.phar
echo "PHPUnit version"
php phpunit-12.phar --version
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Giacomo92 you have a conflict in this pull request, as last week's changes through #7426 handled PHP 8.4 and 8.5 (in other words, you should remove your proposed changes in build.sh)

Comment thread CMakeLists.txt Outdated
option(WITH_GIF "Enable GIF support (for PIXMAP loading)" ON)
option(WITH_PYTHON "Enable Python mapscript support" OFF)
option(WITH_PHPNG "Enable PHPNG (SWIG) mapscript support" OFF)
option(WITH_PHPNG "Enable PHPNG (SWIG) mapscript support" ON)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Giacomo92 all mapscripts should be OFF by default

if(NOT PHP_INCLUDE_PATH)
message(WARNING "PHP_INCLUDE_PATH is empty. Attempting to guess based on standard locations.")
# Common locations on Linux/macOS
find_path(PHP_H_LOCATION php.h PATHS
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite understanding, as most installations do not include PHP source, so will never contain a php.h file (the command php-config --includes will just return a path to the extension-dir)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are proposing to have all installations require php-dev headers? (I am not sure why we would need this suddenly, for all installations).

@jmckenna
Copy link
Copy Markdown
Member

The PHP 8.4 and 8.5 CI builds have been running for 3.5 hours for this pull request, stuck on the PHPUnit section, I have now cancelled the run.

@Giacomo92
Copy link
Copy Markdown
Author

Thanks for the feedback. I’m trying to update support up to PHP 8.5, but I’m running into a lot of build errors. I’m working on it.

…HP 8.4/8.5 and GDAL 3.11

- ci/ubuntu/build.sh: Added test metrics summary (PHP & Python) and code coverage reporting
- ci/ubuntu/Dockerfile: Disabled auto-regeneration of expected files in build
- ci/ubuntu/setup.sh: Added PHP 8.4/8.5 and Python dependencies
- msautotest/php/run_test.sh: Updated for PHPUnit 13 support
- msautotest/*: Updated expected test outputs for WCS/WFS/GDAL/Misc suites to match GDAL 3.11 output
- src/*: Included PHP 8.4 compatibility changes
…d test reporting

- Added @group php84 annotation to php84DeprecationTest class
- Modified run_test.sh to use --exclude-group php84 when running on PHP < 8.4
- This eliminates the 18 'skipped' tests on PHP 8.3 since they're not relevant for that version

The tests are now filtered before execution rather than being skipped during execution,
providing cleaner test output for users running on older PHP versions.
@Giacomo92 Giacomo92 changed the title Feat upgrade php 84 85 Upgrade PHP MapScript support for PHP 8.4 and 8.5 Feb 19, 2026
"wms_title" "road"
"wms_description" "Roads of I.P.E."
"wms_srs" "EPSG:43204"
"wms_srs" "EPSG:4326"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the original EPSG was the old custom 42304 (the 43204 here seems to be a typing mistake). The new (I filed it to EPSG back in 2008 and got it approved) EPSG to use here instead is EPSG:3978). So the original source here is not 4326, but instead should be 3978 in this mapfile (if the original data is the same)

@jmckenna
Copy link
Copy Markdown
Member

@Giacomo92 currently we reduced the CI to only test PHP 8.4 and 8.5 (as development support for PHP 8.3 ended in December). I don't see a need to add compute resources to 8.3 (or please give your reasoning here, thanks).

@jmckenna
Copy link
Copy Markdown
Member

jmckenna commented Feb 19, 2026

@Giacomo92 you mention in the Description (thanks for updating this) that one of the goals is to have the CI test PHP 8.3, but as you notice in the workflows running now for this pull request, and also in your fork, this current pull requet only tests PHP 8.4 and 8.5 (see workflow run). You would need to change build-mapscript-php.yml (if you explain why we would be requiring to re-add PHP 8.3, per my previous comment)

@Giacomo92
Copy link
Copy Markdown
Author

@jmckenna Hi, thanks for pointing that out!
Apologies for the confusion, I've been working on these changes for a while and hadn't realized that PHP 8.3 support had already been dropped from the CI matrix. I'll re-align the PR accordingly and remove any references to 8.3.
On that note, do you have any suggestions or known considerations for improving stability on PHP 8.4 and 8.5? We're using MapScript in some internal projects and I'd like to make sure things are solid on those versions going forward.
Also, while running the tests locally, I noticed that some files are being generated or modified that are currently tracked in the repository. That's actually the reason I included some changes to .gitignore in this PR, to avoid committing build artifacts or auto-generated files by mistake. Have you noticed this as well on your end?
As a side note, I also added a Docker-based build setup targeting Ubuntu, since building MapServer natively on macOS wasn't feasible. This way I could test and iterate on the changes locally in an environment closer to what CI uses.

@geographika
Copy link
Copy Markdown
Member

@Giacomo92 - there are many changes in this pull request unrelated to PHP (changes to Python, mapfile.c, the lexer etc.). I'd recommend breaking this into smaller more focussed PRs (the 8,5 update and tests, then possibly Docker), if you want to see these changes merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants