|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39814 is_numeric() timeout/infinite loop on long numeric strings
Submitted: 2006-12-13 12:00 UTC Modified: 2006-12-21 01:00 UTC
From: tim at digicol dot de Assigned:
Status: No Feedback Package: Variables related
PHP Version: 5.2.0 OS: Linux 2.4 (SuSE SLES 8.1)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-12-13 12:00 UTC] tim at digicol dot de

the example code is taking forever (i.e., not terminating at all) on one of our Linux boxes:

uname -a
Linux dc5test 2.4.21-241-smp #1 SMP Tue Aug 10 15:55:34 UTC 2004 i686 unknown

cat /etc/SuSE-release
SuSE SLES-8 (i386)

php -i | grep configure
./configure --with-libxml-dir=/services/usr/bin --prefix=/services/webserver/php/php-5.2.0 --with-db4=/services/database/db4/active --with-sqlite --enable-dba --with-apxs2=/services/webserver/apache/active/bin/apxs --with-bz2 --with-dom --with-gd --with-iconv --enable-sockets --with-zlib --disable-debug --enable-inline-optimization --enable-memory-limit --enable-magic-quotes --enable-safe-mode --enable-sigchild --enable-pcntl --with-oci8=/opt/oracle/product/9.2.0 --disable-ctype --without-mysql --enable-cli --with-pear --enable-exif --enable-ftp --enable-mbstring --with-libxml-dir=/services/usr

Changes compared to php.ini-recommended:
short_open_tag = On
memory_limit = 82M
error_log = /dot/dc/logs/php4_error.log
post_max_size = 64M
date.timezone = Europe/Berlin
browscap = /dot/dc/system/install/init/browscap.ini
session.save_path = "/tmp"
session.gc_divisor     = 100
session.gc_maxlifetime = 43200
url_rewriter.tags = ""
mbstring.internal_encoding = UTF-8

The funny thing is that the same code runs fine on our other servers (which run various 32bit and 64bit SuSE versions, but Linux 2.6 instead of 2.4).

I can work around this problem (and I don't really care whether is_numeric() returns true or false in this case), but I thought you might be interested anyway.

Thanks for your attention,

Reproduce code:
php -r 'echo is_numeric("16743175142160148228252851852361751021052084") . "\n";'

Expected result:

Actual result:
[no result, script runs forever]


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-13 12:12 UTC]
Please try using this CVS snapshot:
For Windows:

 [2006-12-13 13:03 UTC] tim at digicol dot de
Happens with "PHP 5.2.1-dev (cli) (built: Dec 13 2006 13:39:51)" as well. GCC is version 3.2.2.

CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"

cd php5.2-200612131130
./configure \
--with-libxml-dir=/services/usr/bin \
--prefix=/services/webserver/php/php5.2-200612131130 \
--with-db4=/services/database/db4/active \
--with-sqlite \
--enable-dba \
--with-apxs2=/services/webserver/apache/active/bin/apxs \
--with-bz2 \
--with-dom \
--with-gd \
--with-iconv \
--enable-sockets \
--with-zlib \
--disable-debug \
--enable-inline-optimization \
--enable-memory-limit \
--enable-magic-quotes \
--enable-safe-mode \
--enable-sigchild \
--enable-pcntl \
--with-oci8=/opt/oracle/product/9.2.0 \
--disable-ctype \
--without-mysql \
--enable-cli \
--with-pear \
--enable-exif \
--enable-ftp \
--enable-mbstring \
 [2006-12-13 13:27 UTC]
Please rebuild PHP with just ./configure --disable-all --enable-debug and see if it helps. If it does, disable the configure options one by one and see which one causes it (I'd start with --enable-inline-optimization and --with-apxs2).
 [2006-12-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 00:03:49 2021 UTC