[Mapserver-dev] PHP Mapscript module and RegEx

Anthony Best abest at digitalflex.net
Sat Sep 25 16:02:14 EDT 2004


Daniel Morissette wrote:

> Anthony Best wrote:
>
>>
>> What is the real problem that requires mapscript to use php's bundled 
>> regex?
>>
>
> The problem was that when you have PHP built with its bundled regex, 
> and MapServer's core built with the system regex, you end up with two 
> slightly different versions of the same library loaded in your symbol 
> table at runtime. For instance both have the same struct regex_t but 
> of different sizes. Both copies of the lib also have the same set of 
> functions with the same names, but build for a different regex_t. What 
> happens at runtime is that sometimes the wrong regex function gets 
> called in the wrong context and pooouff... segmentation fault.
>
> This same type of intermittent crash also happens if PHP and MapServer 
> are compiled with different versions of other libs such as GD, libpng, 
> etc. The key is that you should never have two different versions of 
> the same library linked into the same executable either statically of 
> via a shared library.
>
>
>> Is there still a problem with thread-safety?
>>
>
> There is at least one issue with the temporary filenames generated by 
> imageObj.saveWebImage()... I'm not sure what it is, I just know that 
> based on symptomsreported by users, there is a bug about that. There 
> are quite likely others that will be found with more testing.
>
>> I'm also getting the impression that mapscript is incorrectly using the
>> php4 API. Is this true?
>>
>
> I'm not sure to understand what you mean here?

Uh, sorry... I've heard that mapscript hasn't been fully ported from 
php3 to php4. I suspect this was just because of the directory name. I 
haven't heard anything to prove or disprove this yet.

>
>> I'm willing to put the time and effort into fixing this issue (as well
>> as other issues).
>>
>
> Unfortunately the solution to this specific regex problem is not in 
> MapServer's code: we need to either compile MapServer with PHP's 
> regex, or find a way to force PHP to build with the system regex when 
> built as an Apache DSO. For some reason that I don't undertand, the 
> PHP developers have put an explicit test in the PHP configure script 
> to prevent PHP from using the system regex when built as an Apache 
> DSO... so we're kind of stuck.
>
It seems to me that php is doing this for a similar reason as apache 
also has its own regex, I'll investigate.

So is this just affecting mapserver, or is it also affecting any of the 
other librarys used by mapserver?

Thank you,

Anthony



More information about the mapserver-dev mailing list