php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46174 _pcre_utt_names is overridden from libpcre.so and results in \p match failure
Submitted: 2008-09-25 16:13 UTC Modified: 2008-09-26 12:14 UTC
From: pageexec at freemail dot hu Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.2.6 OS: linux
Private report: No CVE-ID: None
 [2008-09-25 16:13 UTC] pageexec at freemail dot hu
Description:
------------
the pcre extension contains a copy of some specific version of libpcre, with most of the names prefixed with php_ except for _pcre_utt_names which is not prefixed. this means that if a libphp user such as apache2 also happens to load libpcre (mine's directly linked against it so it loads before libphp), the symbols from the latter may override _pcre_utt_names and libphp will use the wrong names table when analyzing \p and \P (the indices would come from php__pcre_utt which is specific for the _pcre_utt_names table contained in the pcre extension).

Reproduce code:
---------------
preg_match_all("/\pL/u", "php", $matches);
print_r($matches);

Expected result:
----------------
Array
(
    [0] => Array
        (
            [0] => p
            [1] => h
            [2] => p
        )

)


Actual result:
--------------
Warning: preg_match_all() [function.preg-match-all]: Compilation failed: unknown property name after \P or \p at offset 3 in <test.php> on line <x>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-25 16:18 UTC] pageexec at freemail dot hu
i guess the simple fix is to add

#define _pcre_utt_names php__pcre_utt_names

to main/php_compat.h.
 [2008-09-25 17:20 UTC] nlopess@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.3-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.3-win32-installer-latest.msi

I believe this is fixed in latest cvs.
 [2008-09-26 08:00 UTC] pageexec at freemail dot hu
yes, it's fixed in the snapshots indeed, now the only remaining issue is that the 5.3 release isn't out yet ;).
 [2008-09-26 12:14 UTC] nlopess@php.net
as the problem is already fixed in CVS, there's nothing left to do :)
PHP 5.3 will be released soon (we hope)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 23:01:30 2024 UTC