php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tim at digicol dot de
New email:
PHP Version: OS:

 

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

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)
VERSION = 8.1

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,
Tim

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

Expected result:
----------------
1

Actual result:
--------------
[no result, script runs forever]

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-13 12:12 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [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.

PATH=/services/usr/bin:/opt/oracle/product/9.2.0/bin:/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome2/bin:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/bin:/opt/gnome/bin
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j5"
export CHOST CFLAGS CXXFLAGS MAKEOPTS PATH

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 \
--with-libxml-dir=/services/usr
 [2006-12-13 13:27 UTC] tony2001@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC