Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include mserror.i and call msSetup() for PHP7 Swig mapscript #5946

Merged
merged 2 commits into from Dec 12, 2019
Merged

Include mserror.i and call msSetup() for PHP7 Swig mapscript #5946

merged 2 commits into from Dec 12, 2019

Conversation

bragef
Copy link
Contributor

@bragef bragef commented Dec 11, 2019

The default exception handling routines in mserror.i is missing if the only mapscript module defined is SWIGPHP7. This causes all mapscript errors to throw an uncathable 'E_ERROR' and quit php instead of throwing an exception.

@bragef
Copy link
Contributor Author

bragef commented Dec 11, 2019

Please ignore this for now; will do some more testing here.

@jmckenna
Copy link
Member

jmckenna commented Dec 11, 2019

roger, thanks @bragef

@bragef
Copy link
Contributor Author

bragef commented Dec 12, 2019

I think this should be safe to commit. I was a bit hesitant because I got a some exceptions which did not make sense after enabling the exeption handlers, e.g. the getMetaData methods trown an exception for a non-existent key. However, looking at the code this was more of a mis-feature than a bug. At any rate, it can be avoided by using acessing the hashObj instead. I also got a couple of exceptions because of a font initialisation bug (see below)

@bragef
Copy link
Contributor Author

bragef commented Dec 12, 2019

The PHP Swig mapscript was missing a call to msSetup(), so that the font cache was not properly initialized.

This causes labels to not appear on maps, or appear erratically. Without exceptions, I got a lot of errors of the type

[Wed Dec 11 13:59:21 2019].450696 msGetFontFace(): General error message. Freetype was unable to load font file "arial.ttf" for key "arial"

and with exceptions enabled mapscript threw an exeption when drawLabelCache() were called.

This is the same issue as is described in this thread:
http://osgeo-org.1560.x6.nabble.com/PHP-Mapscript-swig-issue-on-macOS-td5414228.html

@bragef bragef changed the title Include mserror.i for PHP7 Swig mapscript builds Include mserror.i and call msSetup() for PHP7 Swig mapscript Dec 12, 2019
@jmckenna
Copy link
Member

jmckenna commented Dec 12, 2019

I cannot reproduce the initial font errors reported, and still cannot. However your changes look valid. Merging...

@jmckenna jmckenna merged commit b64932c into MapServer:master Dec 12, 2019
@jmckenna
Copy link
Member

jmckenna commented Dec 12, 2019

thanks again @bragef !!

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.

None yet

2 participants