#23457 [Ver]: PHP crashes

From: Date: Sun, 04 May 2003 10:26:32 +0000
Subject: #23457 [Ver]: PHP crashes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-39017@lists.php.net to get a copy of this message
ID: 23457 Updated by: nicos@php.net Reported By: xdanny at email dot cz Status: Verified Bug Type: Date/time related Operating System: ANY PHP Version: 4.3.2RC1 New Comment: Note that you will be get a notice if you use error_reporting(E_ALL); : Notice: Use of undefined constant DATEFORMAT - assumed 'DATEFORMAT' in - on line 3 -(3) : Notice - Use of undefined constant DATEFORMAT - assumed 'DATEFORMAT' Previous Comments: ------------------------------------------------------------------------ [2003-05-04 05:17:09] nicos@php.net This probably happens because the engine accepts unquoted word when it's alone. It takes it as $today = date('DATEFORMAT',$timestamp); Yes this is ugly but I don't think this can be changed if we dont want to break BC again. Btw if you try $today = date(DATEFORMAT LOL,$timestamp); It will parser error but not with only one word. ------------------------------------------------------------------------ [2003-05-04 05:13:08] nicos@php.net I have the same problem with PHP5: [Sun May 4 - 12:08:17 - nicos ~]$ php <?php //define(DATEFORMAT, 'Y/m/d'); $timestamp = Time(); $today = Date(DATEFORMAT, $timestamp); echo "Hi, today is $today"; ?> Hi, today is SunPMCESTEMay+0200RMayPMCEST [Sun May 4 - 12:08:19 - nicos ~]$ PHP 5.0.0-dev (cli) (built: Apr 27 2003 15:59:15) Copyright (c) 1997-2003 The PHP Group Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies Same with : PHP 4.3.2-RC1 (cli) (built: May 1 2003 19:59:00) Copyright (c) 1997-2003 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies Shouldn't it print an E_FATAL when we're using an undefined constant? ------------------------------------------------------------------------ [2003-05-02 17:52:12] xdanny at email dot cz My environment is PHP 4.3.2 RC1 on W2K with IIS ISAPI module. Don't exactly know - I only suppose that this problem is related more to Date function than to IIS - i don't have enough systems to test on. In normal situation you should have all constants set up, thats true, but if any of your customers run wrong script on your server machine, he could cause crash of whole IIS. The symptom is simple: If you use not defined constant in date format parameter of Date() function it causes Access violation and crashes IIS. PHP has encountered an Access Violation at 014FD4EB A script causing PHP <?php //define(DATEFORMAT, 'Y/m/d'); $timestamp = Time(); $today = Date(DATEFORMAT, $timestamp); echo "Hi, today is $today"; ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23457&edit=1

« previous php.bugs (#39017) next »