From:             jordi at telematictraining dot com
Operating system: Debian GNU/Linux Stable
PHP version:      5.2.0
PHP Bug Type:     Compile Failure
Bug description:  C ompilation failure on preg_match_all()

Description:
------------
Hi there,

What we did? Update php 5.1.6 to 5.2.0.
What we wanted to happen? We expected the 5.2.0 version to behave/work as
the previous ones (5.1.2, 5.1.4 and 5.1.6).
What actualy happened? It didn't.

We have a php based app and we've been working since php version 5.1.2.
But with this new version (5.2.0) it seems to be a problem with the
preg_match_all() function.

Being the function call preg_match_all(string $pattern, string $subject,
array $coincidences), this are the values of the variables:

$pattern =
"/((field):(codigo_doa|titulo_obra|titulo_alternativo|num_serie|ejemplar_serie|ej
emplares_obra|nombre_tecnica|materiales_soporte|medidas_diametro|lista_artistas|m
edidas_peso|medidas_resolucion|epoca_corriente|medidas_minutaje|color|sonido_cana
les|numero_normalizado|valor|fecha_creacion|medidas_longitud|es_firmado|exactitud
_fecha|tipo_obra|tipologia_objeto|tipo_tecnica|unidades_medidas|unidades_peso|tip
o_formato|nombre_formato_imagen|arquitectura|hay_sonido|sonido_nombre_formato|son
ido_muestreo|sonido_amplitud|sonido_idioma_original|pais_publicacion))|((barcode)
:((\_[ABC]){0,1}(\((\d+)\)){0,1}(\{(codigo_doa|titulo_obra|titulo_alternativo|num
_serie|ejemplar_serie|ejemplares_obra|nombre_tecnica|materiales_soporte|medidas_d
iametro|lista_artistas|medidas_peso|medidas_resolucion|epoca_corriente|medidas_mi
nutaje|color|sonido_canales|numero_normalizado|valor|fecha_creacion|medidas_longi
tud|es_firmado|exactitud_fecha|tipo_obra|tipologia_objeto|tipo_tecnica|unidades_m
edidas|unidades_peso|tipo_formato|nombre_formato_imagen|arquitectura|hay_sonido|sonido_nombre_forma
to|sonido_muestreo|sonido_amplitud|sonido_idioma_original|pais_publicacion)\}){1,
45}))/";

$subject = "<table width="100%"> <tr> <td class="field_label">Tipo de
objeto / Type of object: </td> <td class="field">field:tipologia_objeto
(field:tipo_obra)</td> </tr> <tr> <td class="field_label">Objeto de arte
registrado en AICOA / Work of art registered in AICOA: </td> <td
class="field">field:codigo_doa</td> </tr> <tr> <td
class="field_label">Título de la obra (Título alternativo) / Title
(Alternative title): </td> <td class="field">field:titulo_obra
(field:titulo_alternativo)</td> </tr> <tr> <td class="field_label">Autor /
Author: </td> <td class="field">field:lista_artistas</td> </tr> <tr> <td
class="field_label">Fecha realización / Date or period: </td> <td
class="field">field:fecha_creacion (field:exactitud_fecha)</td> </tr> <tr>
<td class="field_label">Escuela, corriente estilística / School, art
movement: </td> <td class="field">field:epoca_corriente</td> </tr> <tr>
<td class="field_label">Datos de la serie / Serial Number: </td> <td
class="field">field:ejemplar_serie / field:ejemplares_obra -- serie:
field:num_serie</td> </tr> <tr> <td class="field_label">Características
del formato / Format characteristics: </td> <td
class="field">field:tipo_tecnica , resolución:
field:medidas_resolucion</td> </tr> <tr> <td class="field_label">Técnica /
Technique:</td> <td class="field">field:nombre_tecnica</td> </tr> <tr> <td
class="field_label">Materiales-Soporte / Material-Support:</td> <td
class="field">field:materiales_soporte</td> </tr> <tr> <td
class="field_label">Medidas / dimensions:</td> <td class="field">
field:medidas_longitud field:unidades_medidas // Ø field:medidas_diametro
field:unidades_medidas // field:medidas_peso field:unidades_peso </td>
</tr> <tr> <td class="field_label">Firmado / Signed</td> <td
class="field">field:es_firmado</td> </tr> </table>"

The function breaks down giving this message:

Warning: preg_match_all() [function.preg-match-all]: Compilation failed:
repeated subpattern is too long at offset 1153 in
/home/.../dcombs_controller.php on line 723

Warning: preg_match_all() [function.preg-match-all]: Compilation failed:
repeated subpattern is too long at offset 1153 in
/home/.../dcombs_controller.php on line 723

We don't know if this is a bug, but we haven't seen any change related to
this on the 5.2.0 changelog. Just in case this could be a variable size
limitation (of 1024?), the $pattern is 1158 characters long and the
$subject is 1738 charachers.


Reproduce code:
---------------
See description.

Configure line: ./configure --prefix=/usr/local
--with-config-file-path=/usr/local/etc --with-apxs2=/usr/bin/apxs2
--with-mod_charset --with-openssl --with-kerberos --with-zlib
--enable-bcmath --with-bz2 --enable-calendar --with-curl
--with-curlwrappers --with-gd --with-ttf --enable-gd-native-ttf
--with-gettext --with-mcrypt --with-mysql --with-mysqli --with-snmp
--enable-wddx-with-xmlrpc --with-xsl --enable-sysvmsg --enable-sysvsem
--enable-sysvshm --with-freetype-dir --with-xml --with-libxml
--with-expat-dir --with-xmlrpc --enable-soap --enable-mbstring
--enable-mbstr-enc-trans --with-pgsql --with-tidy

Other configure options are removing --with-tidy.


Expected result:
----------------
The the preg_match_all() to work as it did on all 5.x php versions until
the date (except for 5.2.0).

Actual result:
--------------
Warning: preg_match_all() [function.preg-match-all]: Compilation failed:
repeated subpattern is too long at offset 1153 in
/home/.../dcombs_controller.php on line 723

Warning: preg_match_all() [function.preg-match-all]: Compilation failed:
repeated subpattern is too long at offset 1153 in
/home/.../dcombs_controller.php on line 723

-- 
Edit bug report at http://bugs.php.net/?id=39415&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39415&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39415&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39415&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39415&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39415&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39415&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39415&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39415&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39415&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39415&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39415&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39415&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39415&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39415&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39415&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39415&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39415&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39415&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39415&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39415&r=mysqlcfg

Reply via email to