weird php eregi behaviour in wamp and xampp -


this question has answer here:

recently saw problem in simple code:

$regexp = "^((http://)|(https://)|(mailto:)|(ftp://))?(([a-za-z0-9_.!~*'()-]|(%[0-9a-fa-f]{2})|[;&=+$,])+(:([a-za-z0-9_.!~*'()-]|(%[0-9a-fa-f]{2})|[;:&=+$,])+){0}@){0}((((((2(([0-4][0-9])|(5[0-5])))|([01]?[0-9]?[0-9]))\.){3}((2(([0-4][0-9])|(5[0-5])))|([01]?[0-9]?[0-9]))))|(([a-za-z0-9](([a-za-z0-9-]{0,62})[a-za-z0-9])?\.)*([a-za-z](([a-za-z0-9-]*)[a-za-z0-9])?)))?(:(([0-5]?[0-9]{1,4})|(6[0-4][0-9]{3})|(65[0-4][0-9]{2})|(655[0-2][0-9])|(6553[0-5])))?(/((;)?([a-za-z0-9_.!~*'()-]|(%[0-9a-fa-f]{2})|[:@&=+$,])+(/)?)*)?(\?([;/?:@&=+$,]|[a-za-z0-9_.!~*'()-]|(%[0-9a-fa-f]{2}))*)?(#([;/?:@&=+$,]|[a-za-z0-9_.!~*'()-]|(%[0-9a-fa-f]{2}))*)?$"; $urladdr = '89.221.92.122/api/xml'; $result = eregi($regexp, $urladdr); 

wamp server returns true, while xampp server returns false! know eregi deprecated, right know expect work fine in php 5.3.1

my question

is there php or apache config caused behavior?

a simple test file of script uploaded here: eregi on xampp + phpinfo
above code in wamp here: eregi on wamp + phpinfo

i don't want solve problem, want know why kind of problems happen.

it appears posix "extended regex" module/extension can either take advantage of native system support or use implementation bundled php source. haven't found clear reference this, there clues:

  • in the extension's "installation" instructions, option described of 3 implementations compile in. note 1 of options "apache", implying under windows, "third-party" implementation might available.
  • you can browse source code implementations loaded, e.g. series of if statements in ext/ereg/php_regex.h
  • the phpinfo() output posted includes line "bundled library enabled". (incidentally, came upon source outputs that: ext/ereg/ereg.c line 238.

this quite common many of older parts of php, built on system libraries , apis can reliably found on "posix-compliant" systems, , later "ported" other systems reimplementing required functionality. causes discrepancies between platforms, particularly on windows, of expected libraries missing.

recent versions of php have tried identify , rectify such inconsistencies - instance, many of filesystem-related functions used have warnings of limited or incorrect behaviour under windows, show these fixed in particular version. however, since particular extension has been deprecated in favour of cross-platform pcre library, there has not been great deal of testing of different implementations, before official deprecation notice added in php 5.3.


Comments

Popular posts from this blog

HTTP/1.0 407 Proxy Authentication Required PHP -

curl - PHP fsockopen help required -

c# - Resource not found error -