【发布时间】:2013-03-14 13:04:03
【问题描述】:
我使用php.exe 运行了以下脚本:
preg_replace('#(?:^[^\pL]*)|(?:[^\pL]*$)#u','',$string);
或其等价物:
preg_replace('#(?:^[^\pL]*|[^\pL]*$)#u','',$string);
如果$string="S" 或$string=" ذذ " 有效,如果string='ذ' 它产生� 不正确,如果string='ذذ' PHP 崩溃。
但它适用于 4.4.0 - 4.4.9、5.0.5 - 5.1.6 版本。
怎么了?
<?php
$string='دد';
echo preg_replace('#(?:^[^\pL]*)|(?:[^\pL]*$)#u','',$string);
5.4.0 - 5.5.0alpha6 的输出
Process exited with code 139.5.2.0 - 5.3.22、5.5.0beta1 的输出
4.4.0 - 4.4.9、5.0.5 - 5.1.6 的输出
دد4.3.11、5.0.0 - 5.0.4 的输出
Warning: preg_replace(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 7 in /in/T3rpV on line 34.3.0 - 4.3.10 的输出
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 7 in /in/T3rpV on line 3
【问题讨论】:
-
这里也崩溃了。 PHP 5.4.7。
-
我可以确认,最新的 beta 版本 PHP 5.5.0beta2(3 月 28 日发布)也会崩溃!
-
@ComFreek 我的回答是否也让它崩溃了?
标签: php crash preg-match