php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9536 date("<br>") gives wrong output
Submitted: 2001-03-03 06:32 UTC Modified: 2001-03-03 17:14 UTC
From: michael dot mauch at gmx dot de Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.0.4pl1 OS: Linux, Win98, Win2k
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: michael dot mauch at gmx dot de
New email:
PHP Version: OS:

 

 [2001-03-03 06:32 UTC] michael dot mauch at gmx dot de
Variations of date("<br>") returns wrong output or lets PHP
dump core. This bug has been reported by Christian Hamacher
in de.comp.lang.php, followups reported similar problems on
Win 98 and Win 2000.

Here on Linux 2.4.2 I see:

% echo '<?
$Date=date("d.m.Y <br> H:i:s");
echo "$Date\n";
?>' | php -q
03.03.2001 <bSat,  3 Mar 2001 12:16:42 +0100>
808132658:876230193:976367904

No core dump here if I run in the Bash, but wrong output.
In zsh, I get a core dump (and the wrong output):

% echo '<?
$Date=date("d.m.Y <br> H:i:s");
echo "$Date\n";
?>' | php -q
03.03.2001 <bSat,  3 Mar 2001 12:20:05 +0100>
808132661:809119794:976367904
zsh: done                              echo <?
$Date=date("d.m.Y <br> H:i:s");
echo "$Date\n";
?> |
zsh: segmentation fault (core dumped)  php -q

% gdb =php core
GNU gdb 4.17.0.11 with Linux support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or distribute copies of it under
certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show
warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Core was generated by `php -q'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libdl.so.2...done.
Reading symbols from /usr/local/lib/libz.so.1...done.
Reading symbols from /usr/local/lib/libreadline.so.4.1...done.
Reading symbols from /usr/local/lib/libhistory.so.4.1...done.
Reading symbols from /lib/libncurses.so.5...done.
Reading symbols from /usr/lib/libttf.so.2...done.
Reading symbols from /usr/local/lib/libpng.so.2...done.
Reading symbols from /usr/X11R6/lib/libX11.so.6...done.
Reading symbols from /usr/X11R6/lib/libXpm.so.4...done.
Reading symbols from /usr/local/lib/libjpeg.so.62...done.
Reading symbols from /usr/local/lib/libxml.so.2...done.
Reading symbols from /usr/lib/libgdbm.so.1...done.
Reading symbols from /usr/local/lib/libcurl.so.0...done.
Reading symbols from /lib/libresolv.so.2...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /lib/libcrypt.so.1...done.
Reading symbols from /lib/libnsl.so.1...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /lib/libnss_db.so.2...done.
Reading symbols from /lib/libdb.so.3...done.
Reading symbols from /lib/libnss_files.so.2...done.
#0  chunk_free (ar_ptr=0x403b8220, p=0x8267070) at malloc.c:3049
malloc.c:3049: No such file or directory.
(gdb) bt
#0  chunk_free (ar_ptr=0x403b8220, p=0x8267070) at malloc.c:3049
#1  0x4032e14a in __libc_free (mem=0x8267078) at malloc.c:3023
#2  0x80ed001 in _efree (ptr=0x8267084) at zend_alloc.c:238
#3  0x80e1ec9 in zend_hash_destroy (ht=0x826192c) at
zend_hash.c:569
#4  0x80f1950 in shutdown_executor () at zend_execute_API.c:165
#5  0x80e48e4 in zend_deactivate () at zend.c:525
#6  0x8072ca2 in php_request_shutdown (dummy=0x0) at main.c:688
#7  0x806faff in main (argc=2, argv=0xbffff2ac) at
cgi_main.c:771
#8  0x402f58c1 in __libc_start_main (main=0x806f30c <main>,
argc=2,
    argv=0xbffff2ac, init=0x806d3f8 <_init>, fini=0x819b2a4
<_fini>,
    rtld_fini=0x4000a914 <_dl_fini>, stack_end=0xbffff2a4)
    at ../sysdeps/generic/libc-start.c:92
(gdb)


If I ask for a "<b>" instead for "<br>", everything is ok.
Of course there are easy work-arounds (just use `echo
"<br>"' instead), but nevertheless.

Regards...
			Michael

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-03 17:14 UTC] sniper@php.net
The segfault bug is fixed in CVS already. 
FYI (from NEWS file):

- Added 'r' flag to date() which generates an RFC822 formatted date, e.g.
  "Thu,  9 Nov 2000 16:33:01 -0500" (Colin)

--Jani



 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Jan 21 20:03:35 2022 UTC