#30224 [NEW]: Sybase module complains that date strings are not null terminated

2004-09-24 Thread tyler at nas dot net
From: tyler at nas dot net
Operating system: Redhat 9
PHP version:  4.3.8
PHP Bug Type: Sybase (dblib) related
Bug description:  Sybase module complains that date strings are not null terminated

Description:

I installed a debug version of 4.3.8 to try to diagnose a different
problem and I see many error messages like:

[client 192.168.1.114] PHP Warning:  String is not zero-terminated (Apr 05
2004 12:00AM  \x84\xcc\x8f*ZZZA) (source:
/usr/src/php-4.3.8/Zend/zend_execute_API.c:291) in Unknown on line 0,
referer: http://(my-url)
[client 192.168.1.114] PHP Warning:  String is not zero-terminated (Apr 05
2004 12:00AM  \x84\xcc\x8f*ZZZA) (source:
/usr/src/php-4.3.8/Zend/zend_execute_API.c:291) in Unknown on line 0,
referer: http://(my-url)

#1: It isn't very helpful to not print the actual page the error is on. 
I'm assuming the Unknown would be the page, but it's odd that it can
print the referrer.

#2: I've tracked it down to a page that retrieves marks from a sybase
database on another server.  Those dates that you see in the above are the
dates the student took her tests.

#3: These errors only appear in debug mode.

#4: With either the debug or the normal php, when I print the string there
are no extraneous characters.

#5: No extraneous characters appeared and no warning appeared in a perl
script that pulled and displayed the same information.

#6: My config:
./configure --build=i386-redhat-linux --prefix=/usr --exec-prefix=/usr
--bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
--datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib
--libexecdir=/usr/libexec --localstatedir=/var --mandir=/usr/share/man
--infodir=/usr/share/info --prefix=/usr --with-config-file-path=/etc
--disable-debug --disable-rpath --enable-inline-optimization --with-bz2
--with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-gd --with-gettext
--with-gmp --with-iconv --with-jpeg-dir=/usr --with-mm --with-openssl
--with-expat-dir=/usr --with-zlib --with-layout=GNU --enable-bcmath
--enable-ftp --enable-magic-quotes --enable-safe-mode --enable-sockets
--enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid
--enable-wddx --without-oci8 --with-mysql=/usr/local/mysql
--with-apxs2=/usr/sbin/apxs --with-curl --with-sybase=/usr/local/freetds
--with-mcrypt --enable-debug


Reproduce code:
---
$dbsy = startSyb(); // My connection details are hidden here.

$select = SELECT date_completed .
  FROM student_academic;

$handle = $dbsy-prepare($select);
$result = $dbsy-execute($handle, array());

while ($row = $result-fetchRow(DB_FETCHMODE_ASSOC)) {
}


Expected result:

Nothing, it shouldn't produce any output.

Actual result:
--
Many errors messages like these:

Warning: String is not zero-terminated (Apr 05 2004 12:00AM
„Ì#65533;*Ì#65533;*) (source:
/usr/src/php-4.3.8/Zend/zend_execute_API.c:291) in Unknown on line 0

Warning: String is not zero-terminated (Apr 06 2004 12:00AM
„Ì#65533;*Ì#65533;*A) (source:
/usr/src/php-4.3.8/Zend/zend_execute_API.c:291) in Unknown on
line 0

Warning: String is not zero-terminated (May 18 2004 12:00AM
„Ì#65533;*Ì#65533;*A) (source:
/usr/src/php-4.3.8/Zend/zend_execute_API.c:291) in Unknown on
line 0

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


#24030 [Com]: sprintf with negative floating point type leaves null in string

2003-09-24 Thread tyler at nas dot net
 ID:   24030
 Comment by:   tyler at nas dot net
 Reported By:  prgallier at yahoo dot com
 Status:   Closed
 Bug Type: Strings related
 Operating System: Linux 2.4.20
 PHP Version:  4.3.2
 New Comment:

A temporary work around:
%1.1f doesn't seem to print the nulls like %0.1f does.


Previous Comments:


[2003-06-05 00:56:00] [EMAIL PROTECTED]

Already fixed in CVS.




[2003-06-05 00:39:08] prgallier at yahoo dot com

Using sprintf with a floating point value for a negative number leaves
a null character in the string, such as:
$num = sprintf(%0.1f, -12.5);

$num will contain the following characters within the actual string
when printing out:
0x45 0x31 0x32 0x2E 0x35 0x00

This does not occur with non-negative numbers.

Try the following for realtime example:
?php
$num = sprintf(%0.1f, 12.5);
echo Positive Num: $numbr\n;
$num = sprintf(%0.1f, -12.5);
echo Negative Num: $numbr\n;
?

This is apparently an old bug that's been reintroduced in version
4.3.2.





-- 
Edit this bug report at http://bugs.php.net/?id=24030edit=1