Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#3065 closed defect (fixed)

php/mapscript w/ php 5.3: "regex/regex_extra.h cannot be found"

Reported by: dfuhry Owned by: aboudreault
Priority: normal Milestone: 5.4.2 release
Component: MapScript-PHP Version: svn-trunk (development)
Severity: normal Keywords:
Cc: dmorissette, assefa, jmckenna

Description (last modified by dmorissette)

Php 5.3, released yesterday, seems to change at least the layout of regex-related files. Hence, you get the error "regex/regex_extra.h cannot be found" when running configure.

Hardcoding that condition to true, mapscript/php3/php_regex.c failed to compile since its

#include "regex/regex_extra.h"
#include "regex/regex.h"

files didn't exist. After commenting those out and adding

#include "ext/ereg/regex/regex.h"

things compiled, but apache processes would die with glibc free() errors. In mapscript/php3/php_regex.c, by commenting out the call to regexec() in ms_regexec() (hardcoding return -1), and the calls to regfree() and free() in ms_regfree(), processes no longer segfault.

I hope this info helps in developing a proper patch.

I'm not sure if this matters, but I also changed API_EXPORT #define stuff in mapregex.h to better match that in php's php/ext/ereg/regex/regex.h, which includes an extra clause for

#elif defined(__GNUC__) && __GNUC__ >= 4
#define API_EXPORT(type)    __attribute__ ((visibility("default"))) type

Change History (9)

comment:1 by dmorissette, 15 years ago

Cc: dmorissette assefa jmckenna added
Description: modified (diff)
Milestone: 5.4.2 release
Owner: changed from mapserverbugs to aboudreault

Assigned to Alan to look into this.

Assefa, Jeff: MS4W 3.0-beta seems to be using a RC of PHP 5.3. Did you not encounter those issues?

comment:2 by jmckenna, 15 years ago

Yes I've been using PHP 5.3.0 RCs in builds for a couple of months now, and I've been waiting for other devs to hit these walls also (most if not all of our existing phpmapscript-based apps will break with PHP 5.3.0). Here are my build notes regarding PHP on Windows:

q) compile PHPMapScript

====================

  • set correct paths to regex ($(PHP_HOME)\ext\ereg\regex\) in MapServer's nmake.opt for the REGEX_OBJ and REGEX_INC variables

  • if you get the compile error of "cannot find ../main/config.w32.h" then copy the file from a previous PHP version (such as 5.2.9)

  • if you get the compile error: "unresolved external symbol ZVAL_DELREF referenced in function _phpms_add_property_object"

  • change the following line in /mapscript/php3/php_mapscript_util.c (line ~414)

old:

ZVAL_DELREF(pObjToAdd);

new:

Z_DELREF(pObjToAdd);

  • if when loading the mapscript module ("php -m") you get "Build IDs do not match":

in /php/main/config.w32.h set:

/* Compiler compatibility ID */ #define PHP_COMPILER_ID "VC9"

comment:3 by aboudreault, 15 years ago

Resolution: fixed
Status: newclosed

Fixed and committed in r9153.

comment:4 by assefa, 15 years ago

Alan,

Any chance we should back port the changes to the 5.4.x branch since on windows we would need these changes for the ms4w release (with Mapserver 5.4.x).

comment:5 by aboudreault, 15 years ago

dfuhry, thanks for your informations, they have been very useful. :)

comment:6 by dmorissette, 15 years ago

Yes, I agree that we should backport once we are confident that the fixes don't break anything (that's why I had tagged the ticket for the 5.4.2 release)

comment:7 by aboudreault, 15 years ago

Yes, I agree too. Is anyone could retest my changes with PHP 5.2 and PHP 5.3 under Linux and confirm me that everything is ok ? Then, I'll backport that in 5.4.

comment:8 by assefa, 15 years ago

Alan,

I won't be able to test the changes on different configurations for Linux. But on windows the only change that really matters is the one done in php_mapscript_util.h. And that I can confirm works properly and is pretty safe. So we can at least back port that part safely.

Jeff,

For the PHP_COMPILER_ID, I made a change to php_mapscipt_util.h/makefile.vc so that we can define it in our code. I will commit that. I will update you on other PHP windows stuff through MS4W

comment:9 by aboudreault, 15 years ago

Backported in branch-5-4 in r9180.

Note: See TracTickets for help on using tickets.