|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38327 False notice: lookbehind assertion is not fixed length
Submitted: 2006-08-04 12:28 UTC Modified: 2006-11-16 18:09 UTC
From: php dot net at bokehman dot com Assigned: andrei (profile)
Status: Not a bug Package: PCRE related
PHP Version: 5.1.4 OS: win32
Private report: No CVE-ID: None
 [2006-08-04 12:28 UTC] php dot net at bokehman dot com
The regex posted below is legal and fixed length but raises the following warning: 

lookbehind assertion is not fixed length

Situation: negative lookbehind contains a negated character class.

This bug makes it impossible to use a negated character class anywhere within a negative lookbehind.

Reproduce code:
$regex = '/(?<=[^x])/';


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-04 12:45 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

 [2006-08-04 13:37 UTC] php dot net at bokehman dot com
<?php echo preg_replace('/(?<=[^x])/', '.', 'wx'); ?>

Error message: 
Warning: preg_replace() [function.preg-replace]: Compilation failed: lookbehind assertion is not fixed length at offset 8
 [2006-11-16 18:09 UTC]
no, that is not accepted by PCRE (the library used by PHP to handle the regexes). anyway, most engines don't support more difficult look-ahead/behind. Anyway, this is not a problem in PHP itself.
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC