php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46959 PCRE compiles even if configured not to compile it
Submitted: 2008-12-28 08:21 UTC Modified: 2008-12-29 18:21 UTC
From: ravitanra at gmail dot com Assigned:
Status: Closed Package: PCRE related
PHP Version: 5.2.8 OS: Linux
Private report: No CVE-ID:
 [2008-12-28 08:21 UTC] ravitanra at gmail dot com
Description:
------------
I am trying to build a minimal PHP by removing heavy stuff like PCRE. 

Problem is that PCRE always compiles even if configured not to compile it. Below is the configure line

./configure --prefix=/rt --exec-prefix=/rt --with-config-file-path=/rt/etc --disable-all --disable-ipv6 --with-pcre-regex=no --disable-posix --disable-session --disable-reflection --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear --disable-inline-optimization --enable-maintainer-zts --enable-embed=static --disable-pcre

I also tried "--without-pcre-regex" without any luck. All PCRE function are present in the final build. Please refer to output of the build below


/bin/sh /root/php-5.2.8/libtool --silent --preserve-dup-deps --mode=link /root/php-5.2.8/meta_ccld -export-dynamic -g -O2 -pthread -DZTS     ext/pcre/pcrelib/pcre_chartables.lo ext/pcre/pcrelib/pcre_ucd.lo ext/pcre/pcrelib/pcre_compile.lo ext/pcre/pcrelib/pcre_config.lo ext/pcre/pcrelib/pcre_exec.lo ext/pcre/pcrelib/pcre_fullinfo.lo ext/pcre/pcrelib/pcre_get.lo ext/pcre/pcrelib/pcre_globals.lo ext/pcre/pcrelib/pcre_info.lo ext/pcre/pcrelib/pcre_maketables.lo ext/pcre/pcrelib/pcre_newline.lo ext/pcre/pcrelib/pcre_ord2utf8.lo ext/pcre/pcrelib/pcre_refcount.lo ext/pcre/pcrelib/pcre_study.lo ext/pcre/pcrelib/pcre_tables.lo ext/pcre/pcrelib/pcre_try_flipped.lo ext/pcre/pcrelib/pcre_valid_utf8.lo ext/pcre/pcrelib/pcre_version.lo ext/pcre/pcrelib/pcre_xclass.lo ext/pcre/php_pcre.lo ext/date/php_date.lo ext/date/lib/astro.lo ext/date/lib/dow.lo ext/date/lib/parse_date.lo ext/date/lib/parse_tz.lo ext/date/lib/timelib.lo ext/date/lib/tm2unixtime.lo ext/date/lib/unixtime2tm.lo regex/regcomp.lo regex/regexec.lo regex/regerror.lo regex/regfree.lo ext/standard/array.lo ext/standard/base64.lo ext/standard/basic_functions.lo ext/standard/browscap.lo ext/standard/crc32.lo ext/standard/crypt.lo ext/standard/cyr_convert.lo ext/standard/datetime.lo ext/standard/dir.lo ext/standard/dl.lo ext/standard/dns.lo ext/standard/exec.lo ext/standard/file.lo ext/standard/filestat.lo ext/standard/flock_compat.lo ext/standard/formatted_print.lo ext/standard/fsock.lo ext/standard/head.lo ext/standard/html.lo ext/standard/image.lo ext/standard/info.lo ext/standard/iptc.lo ext/standard/lcg.lo ext/standard/link.lo ext/standard/mail.lo ext/standard/math.lo ext/standard/md5.lo ext/standard/metaphone.lo ext/standard/microtime.lo ext/standard/pack.lo ext/standard/pageinfo.lo ext/standard/quot_print.lo ext/standard/rand.lo ext/standard/reg.lo ext/standard/soundex.lo ext/standard/string.lo ext/standard/scanf.lo ext/standard/syslog.lo ext/standard/type.lo ext/standard/uniqid.lo ext/standard/url.lo ext/standard/url_scanner.lo ext/standard/var.lo ext/standard/versioning.lo ext/standard/assert.lo ext/standard/strnatcmp.lo ext/standard/levenshtein.lo ext/standard/incomplete_class.lo ext/standard/url_scanner_ex.lo ext/standard/ftp_fopen_wrapper.lo ext/standard/http_fopen_wrapper.lo ext/standard/php_fopen_wrapper.lo ext/standard/credits.lo ext/standard/css.lo ext/standard/var_unserializer.lo ext/standard/ftok.lo ext/standard/sha1.lo ext/standard/user_filters.lo ext/standard/uuencode.lo ext/standard/filters.lo ext/standard/proc_open.lo ext/standard/streamsfuncs.lo ext/standard/http.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo TSRM/tsrm_virtual_cwd.lo main/main.lo main/snprintf.lo main/spprintf.lo main/php_sprintf.lo main/safe_mode.lo main/fopen_wrappers.lo main/alloca.lo main/php_scandir.lo main/php_ini.lo main/SAPI.lo main/rfc1868.lo main/php_content_types.lo main/strlcpy.lo main/strlcat.lo main/mergesort.lo main/reentrancy.lo main/php_variables.lo main/php_ticks.lo main/network.lo main/php_open_temporary_file.lo main/php_logos.lo main/output.lo main/streams/streams.lo main/streams/cast.lo main/streams/memory.lo main/streams/filter.lo main/streams/plain_wrapper.lo main/streams/userspace.lo main/streams/transports.lo main/streams/xp_socket.lo main/streams/mmap.lo Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_ts_hash.lo Zend/zend_stream.lo Zend/zend_iterators.lo Zend/zend_interfaces.lo Zend/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/php_cli_readline.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lcrypt -lcrypt -lresolv -lm -ldl -lnsl -lcrypt -lcrypt  -o sapi/cli/php






Reproduce code:
---------------
<?php
// return all array elements
// containing floating point numbers
$fl_array = preg_grep("/^(\d+)?\.\d+$/", $array);
?>


Expected result:
----------------
Code should nork and should give error about 'preg_grep' as missing function since it was not compiled

Actual result:
--------------
Code works fine (which should not)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-29 00:10 UTC] nlopess@php.net
this is by design.
Some time ago it was decided to disallow the disabling of some core extensions, pcre included.
 [2008-12-29 01:52 UTC] pajoye@php.net
Should we not remove the option then?
 [2008-12-29 05:31 UTC] ravitanra at gmail dot com
What are such extensions are? a list will be useful. 

Are there any side effects of removing pcre? I removed pcre by 
removing from the makefile & disabling HAVE_BUNDLED_PCRE macro. It 
compiled and running fine but would be intereing to know side effects

Unless there are strong reasons, IMO, there should be an option to 
remove it and by default those extensions can be bundled.
 [2008-12-29 10:17 UTC] scottmac@php.net
It looks like it was forced enable by accident.

Ilia merged some 5.3 changes into 5.2 and accidentally got the force enabled option too.

http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/config0.m4?r1=1.38.2.3.2.10&r2=1.38.2.3.2.11&pathrev=PHP_5_2

Confirming this now.

With 5.3.0+ we have SPL, Reflection and PCRE all forced as enabled.
 [2008-12-29 15:27 UTC] scottmac@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2008-12-29 17:18 UTC] ravitanra at gmail dot com
Thanks for the fix. Hopefully it will be available in 5.2.9

Btw, why not keep the options to disable in 5.3.0+ releases unless it 
has any serious negatives.
 [2008-12-29 18:10 UTC] scottmac@php.net
ereg, fileinfo, filter, spl, zip and get_browser() are all using PCRE internally. Making it required is useful because it solves dependency issues when you have static and shared modules. It also helps web developers since they can rely on PCRE.

Though I'm not sure what your problem is with it? Sure its a little extra memory but that's the only real runtime cost.
 [2008-12-29 18:21 UTC] ravitanra at gmail dot com
While I somewhat agree with you, I still believe that the giving 
option and create right dependency tree (say zip will not be included 
in pcre is disabled) would be a better idea than to force it.

I am creating a php version with minimal feature, mainly php language 
only (without any extensions). Memory is really at premium in the 
application I am creating.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 13:02:46 2014 UTC