[mapguide-commits] r9947 - in sandbox/jng/vanilla_swig: . Bindings Bindings/src/Bindings/Php

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jun 6 05:12:30 PDT 2022


Author: jng
Date: 2022-06-06 05:12:30 -0700 (Mon, 06 Jun 2022)
New Revision: 9947

Added:
   sandbox/jng/vanilla_swig/csmap_excludes.txt
   sandbox/jng/vanilla_swig/debug_excludes.txt
   sandbox/jng/vanilla_swig/release_excludes.txt
Modified:
   sandbox/jng/vanilla_swig/Bindings/TODO.txt
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php/
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php/README.md
   sandbox/jng/vanilla_swig/build.bat
   sandbox/jng/vanilla_swig/setenvironment64.bat
Log:
- Restore some xcopy exclusion files
- Make dotnet restore more reliable in setenvironment64.bat
- Document PHP migration issues

Modified: sandbox/jng/vanilla_swig/Bindings/TODO.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/TODO.txt	2022-06-06 12:09:54 UTC (rev 9946)
+++ sandbox/jng/vanilla_swig/Bindings/TODO.txt	2022-06-06 12:12:30 UTC (rev 9947)
@@ -70,16 +70,25 @@
    - It should be possible to now get rid of constants.php and define our various constants in the PHP extension itself!
       - [x] Pivot IMake to instead generate a SWIG interface file of constant class defns to be included in the main SWIG interface file
  - Fix up existing web apps
-   - [ ] mapviewerjava
-   - [ ] mapviewerphp
+   - [x] mapviewerjava
+   - [x] mapviewerphp
+      - [x] Fix a method overload issue in quickplotgeneratepicture.php
+      
+      PHP Fatal error:  Uncaught TypeError: No matching function for overloaded 'MgRenderingService_RenderMap' in C:\Workspace\mapguide\MgDev\Release64\Web\www\mapviewerphp\quickplotgeneratepicture.php:115
+Stack trace:
+#0 C:\Workspace\mapguide\MgDev\Release64\Web\www\mapviewerphp\quickplotgeneratepicture.php(115): MgRenderingService->RenderMap(Object(MgMap), Object(MgSelection), Object(MgCoordinateXY), 2500, 2081, 1786, Object(MgColor), 'PNG', false)
+
+          - Suspect that the 3rd param (MgCoordinateXY) is not passing as its parent (MgCoordinate)
+          - Need to setup the same parameter tests in a debuggable PHP script to find out
+      
    - [ ] schemareport
-   - [ ] mapadmin
-   - [ ] fusion
+   - [x] mapadmin
+   - [x] fusion
    - [ ] mapviewernet
      - If raw .aspx files cannot consume our netstandard2.0 package, retian Oem/SwigEx for the purpose of building "legacy" .net bindings
         - ( ) If this is indeed the case, replace the NMake-based .net projects (that call csc.exe) with SDK-style csproj files that target net48
    - [ ] MapGuide Developer's Guide
-   - [ ] viewer samples (PHP)
+   - [x] viewer samples (PHP)
    - [ ] viewer samples (Java)
    - [ ] viewer samples (.net)
      - Give the .net viewer samples the same migration plan as mapviewernet

Index: sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php	2022-06-06 12:09:54 UTC (rev 9946)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php	2022-06-06 12:12:30 UTC (rev 9947)

Property changes on: sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php
___________________________________________________________________
Modified: svn:ignore
## -1 +1,7 ##
 PhpApi.vcxproj.user
+constants.i
+language.i
+MapGuideApi.i
+MapGuideApi_Doc.i
+MgApi_wrap.cpp
+php_MapGuideApi.h
Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php/README.md
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php/README.md	2022-06-06 12:09:54 UTC (rev 9946)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/Php/README.md	2022-06-06 12:12:30 UTC (rev 9947)
@@ -4,49 +4,56 @@
 
 # Supported PHP version
 
-This binding targets the Windows release of PHP 7.1.19, the current PHP version in the 7.1 series.
+This binding targets the Windows release of PHP 8.1.4, the current PHP version in the 8.1 series.
 
 The binding is built against the *non-thread-safe* release of PHP, meaning it currently can only be used in Apache httpd server via FastCGI with the `mod_fcgid` module
 
-No binding is provided for PHP 7.1 on Linux at this point in time as none of the Linux distros where we provide MapGuide binaries for (CentOS 6.x / Ubuntu 14.04), provide an official PHP 7.x package.
+# Migration Notes
 
-# Usage
+## `constants.php` no longer required
 
-NOTE: 
+All constants defined in the MapGuide API are now baked into the PHP extension itself, eliminating the need for us having to generate this file and for your PHP MapGuide applications to include this file.
 
-As MapGuide currently does not bundle PHP 7.1, these instructions assume you already have PHP 7.1 installed. How to install PHP 7.1 is beyond the scope of this document
+Remove all references to `include`/`include_once`/`require`/`require_once` to `constants.php` in your code
 
-1. Copy `php_MapGuideApi.dll` and supporting dlls to the `ext` subdirectory of your PHP 7.1 installation.
-2. Modify `php.ini` and add the line `extension=php_MapGuideApi.dll` to the extensions section of the file.
+## `MgPlotSpecification` constructor
 
-# Known issues
+You now need to specify all 4 margin parameters in the `MgPlotSpecification` constructor. If you don't need a margin, or need to set it later on (with the `SetMargins()` method), you can pass `0.0` for all 4 arguments.
 
- * Some APIs with many overloads may have incorrect wrapper code generated by vanilla SWIG. We've been working around this by monkey-patching away such problematic APIs. Please report any APIs that do not behave as they did in the official PHP 5.x binding.
+## Exception handling
 
- * If you have multiple try/catch blocks within the same scope, make sure to use different exception variable names. For example:
+`MgException` is now the sole exception class in the MapGuide API. Sub-classifications can be determined by checking the value of `GetExceptionCode()`. All known sub-classifications are defined in a new `MgExceptionCodes` string constant class.
 
- ```
- try {
-   //Some code that throws
- } catch (MgException $ex) {
-   //Handle this exception
- }
+For example, a try/catch block like this:
 
- try {
-   //Some more code that throws
- } catch (MgException $ex) {
-   //$ex from previous catch block is not properly cleaned up and will leak memory. You should use a different variable name here
- }
- ```
+```
+try {
+  ...
+} catch (MgUserNotFoundException $ex) {
+  ...
+} catch (MgUnauthorizedAccessException $ex) {
+  ...
+}
+```
 
-# Differences from the official PHP binding
+Needs to be converted to this:
 
- * Usage
-   * You will need to include `MapGuideApi.php` to access the MapGuide API.
+```
+try {
+  ...
+} catch (MgException $ex) {
+  if ($ex->GetExceptionCode() == MgExceptionCodes::MgUserNotFoundException) {
+    ...
+  } else if ($ex->GetExceptionCode() == MgExceptionCodes::MgUnauthorizedAccessException) {
+    ...
+  }
+}
+```
 
- * Removed classes/APIs
-   * `MgLayerBase::MgLayerBase`
-   * `MgMapBase::Open`
-   * `MgResource::Save`
-   * `MgConfigurationException::GetExceptionMessage`
-   * `MgSerializable` This is only a "marker" class for server/webtier serialization plumbing. Needed to be removed so that `MgException` can be rebased against PHP `Exception` to make it throwable.
\ No newline at end of file
+## Stronger typing
+
+PHP 8 is more strict about data types and attempting to do things like assigning `int` to `double` and vice-versa and will generally error out in such cases.
+
+This strictness may arise in calls to APIs like `MgRenderingService`::`RenderMap` where there is a mixture of `int` and `double` parameters in the method signature.
+
+To ensure the correct data types are passed in, wrap expected `int` parameters with `intval()` and expected `double` parameters with `doubleval()`
\ No newline at end of file

Modified: sandbox/jng/vanilla_swig/build.bat
===================================================================
--- sandbox/jng/vanilla_swig/build.bat	2022-06-06 12:09:54 UTC (rev 9946)
+++ sandbox/jng/vanilla_swig/build.bat	2022-06-06 12:12:30 UTC (rev 9947)
@@ -286,9 +286,9 @@
 :install_server
 echo [install]: Server
 echo [install]: Server - Binaries
-%XCOPY_SINGLE% "%MG_SERVER%\bin\%TYPEBUILD%" "%MG_OUTPUT_SERVER%\bin"
+%XCOPY_SINGLE% "%MG_SERVER%\bin\%TYPEBUILD%" "%MG_OUTPUT_SERVER%\bin" /EXCLUDE:%CONFIGURATION%_excludes.txt
 echo [install]: Server - FDO
-%XCOPY% "%MG_SERVER%\bin\%TYPEBUILD%\FDO" "%MG_OUTPUT_SERVER%\FDO"
+%XCOPY% "%MG_SERVER%\bin\%TYPEBUILD%\FDO" "%MG_OUTPUT_SERVER%\FDO" /EXCLUDE:%CONFIGURATION%_excludes.txt
 echo [install]: Server - Logs
 %XCOPY% "%MG_SERVER%\bin\%TYPEBUILD%\Logs" "%MG_OUTPUT_SERVER%\Logs"
 echo [install]: Server - Packages
@@ -306,11 +306,11 @@
 echo [install]: Server - WMS
 %XCOPY% "%MG_SERVER%\bin\%TYPEBUILD%\wms" "%MG_OUTPUT_SERVER%\wms"
 echo [install]: Server - DBXML
-copy /Y "%MG_BUILD_DBXML_EXE_PATH%\*.exe" "%MG_OUTPUT_SERVER%\bin"
+copy /Y "%MG_BUILD_DBXML_EXE_PATH%\*.exe" "%MG_OUTPUT_SERVER%\bin" /EXCLUDE:%CONFIGURATION%_excludes.txt
 echo [install]: Server - RepositoryAdmin
 %XCOPY% "%MG_SERVER%\RepositoryAdmin" "%MG_OUTPUT_SERVER%\RepositoryAdmin"
 echo [install]: CsMap Dictionaries
-%XCOPY% "%MG_OEM%\CSMap\CsMapDev\Dictionaries" "%MG_OUTPUT_CSMAP%\Dictionaries"
+%XCOPY% "%MG_OEM%\CSMap\CsMapDev\Dictionaries" "%MG_OUTPUT_CSMAP%\Dictionaries" /EXCLUDE:csmap_excludes.txt
 echo [install]: PDBs - Common
 %XCOPY% "%MG_COMMON%\bin\%TYPEBUILD%\*.pdb" "%MG_OUTPUT%\pdbs"
 echo [install]: PDBs - Server
@@ -331,7 +331,7 @@
 echo [install]: Web Tier - mapadmin
 %XCOPY% "%MG_WEB_SRC%\mapadmin" "%MG_OUTPUT_WEB%\www\mapadmin"
 echo [install]: Web Tier - mapagent
-%XCOPY% "%MG_BUILD_MAPAGENT_PATH%" "%MG_OUTPUT_WEB%\www\mapagent"
+%XCOPY% "%MG_BUILD_MAPAGENT_PATH%" "%MG_OUTPUT_WEB%\www\mapagent" /EXCLUDE:%CONFIGURATION%_excludes.txt
 echo [install]: Web Tier - MapGuide API unmanaged binaries
 %XCOPY_SINGLE% "%MG_WEB_BIN%\%TYPEBUILD%\*.dll" "%MG_OUTPUT_WEB%\www\mapagent"
 echo [install]: Web Tier - mapagent test forms
@@ -363,7 +363,7 @@
 echo [install]: Web Tier - mapviewerjava - WEB-INF
 %XCOPY% "%MG_WEB_SRC%\WEB-INF" "%MG_OUTPUT_WEB%\www\WEB-INF"
 echo [install]: Web Tier - PHP Bindings
-%XCOPY% "%CD%\packages\php\%CONFIGURATION%\x64\php_MapGuideApi.*" "%MG_OUTPUT_WEB%\Php\ext"
+%XCOPY% "%CD%\packages\php\%CONFIGURATION%\x64\php_MapGuideApi.*" "%MG_OUTPUT_WEB%\Php\ext" /EXCLUDE:%CONFIGURATION%_excludes.txt
 echo [install]: Web Tier - Java Bindings
 %XCOPY_SINGLE% "%CD%\packages\Java\%CONFIGURATION%\x64\*.jar" "%MG_OUTPUT_WEB%\www\WEB-INF\lib"
 %XCOPY_SINGLE% "%CD%\packages\Java\%CONFIGURATION%\x64\*.dll" "%MG_OUTPUT_WEB%\Tomcat\bin"
@@ -391,7 +391,7 @@
 copy /Y "%MG_WEB%\DevHttpServer\%TYPEBUILD%\*.exe" "%MG_OUTPUT_WEB%\DevHttpServer"
 echo [install]: Web Tier - Apache module
 if not exist "%MG_OUTPUT_WEB%\Apache24\modules" mkdir "%MG_OUTPUT_WEB%\Apache24\modules"
-%XCOPY% /F "%MG_BUILD_MAPAGENT%" "%MG_OUTPUT_WEB%\Apache24\modules"
+%XCOPY% /F "%MG_BUILD_MAPAGENT%" "%MG_OUTPUT_WEB%\Apache24\modules" /EXCLUDE:%CONFIGURATION%_excludes.txt
 
 if "%TYPECOMPONENT%"=="server" goto quit
 if "%TYPECOMPONENT%"=="web" goto quit
@@ -434,8 +434,6 @@
 :install_test
 echo [install]: Test Suite
 %XCOPY% "%MG_UNIT_TEST%" "%MG_OUTPUT_TEST%\UnitTest"
-if not exist "%MG_OUTPUT_TEST%\Oem\SQLite\bin\%TYPEBUILD%" mkdir "%MG_OUTPUT_TEST%\Oem\SQLite\bin\%TYPEBUILD%"
-copy /Y "%MG_BUILD_SQLITE_DOTNET_API%" "%MG_OUTPUT_TEST%\Oem\SQLite\bin\%TYPEBUILD%"
 copy /Y test_readme.txt "%MG_OUTPUT_TEST%"
 copy /Y run_tests.bat "%MG_OUTPUT_TEST%"
 copy /Y run_tests.sh "%MG_OUTPUT_TEST%"

Added: sandbox/jng/vanilla_swig/csmap_excludes.txt
===================================================================
--- sandbox/jng/vanilla_swig/csmap_excludes.txt	                        (rev 0)
+++ sandbox/jng/vanilla_swig/csmap_excludes.txt	2022-06-06 12:12:30 UTC (rev 9947)
@@ -0,0 +1,20 @@
+coordsys.asc
+datums.asc
+ellipsoid.asc
+mreg.asc
+category.asc
+cs_comp.c
+cs_dictdiff.c
+OSTN02.txt
+OSTN97.txt
+TKY2JGD.par
+JGD2011V100.par
+.MRT
+compiler.
+cs-map.
+Usa\Geoid96
+Usa\Geoid99
+Usa\Geoid03
+Usa\NSRS2007
+Usa\NSRS2011
+WW15MGH.GRD
\ No newline at end of file

Added: sandbox/jng/vanilla_swig/debug_excludes.txt
===================================================================
Added: sandbox/jng/vanilla_swig/release_excludes.txt
===================================================================
--- sandbox/jng/vanilla_swig/release_excludes.txt	                        (rev 0)
+++ sandbox/jng/vanilla_swig/release_excludes.txt	2022-06-06 12:12:30 UTC (rev 9947)
@@ -0,0 +1,5 @@
+.pdb
+.exp
+.lib
+.iobj
+.ipdb
\ No newline at end of file

Modified: sandbox/jng/vanilla_swig/setenvironment64.bat
===================================================================
--- sandbox/jng/vanilla_swig/setenvironment64.bat	2022-06-06 12:09:54 UTC (rev 9946)
+++ sandbox/jng/vanilla_swig/setenvironment64.bat	2022-06-06 12:12:30 UTC (rev 9947)
@@ -135,8 +135,9 @@
 SET ANT=ant
 
 rem The bindings solution (with net6.0 projects) will not build from a clean slate without doing a dotnet restore first
+if not exist "%CD%\packages\DotNet\Release" mkdir "%CD%\packages\DotNet\Release"
 pushd %CD%\Bindings\src\Bindings
-dotnet restore
+dotnet restore --force
 popd
 
 echo ======== Environment Variable Summary =============



More information about the mapguide-commits mailing list