php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27442 Bugs on 2/0
Submitted: 2004-03-01 00:33 UTC Modified: 2004-03-12 04:20 UTC
From: kim at openphp dot cn Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.4 OS: Windows Server 2003
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kim at openphp dot cn
New email:
PHP Version: OS:

 

 [2004-03-01 00:33 UTC] kim at openphp dot cn
Description:
------------
Small bugs?I don't know.

<?php
  $value = @ (2 / 0);
?>

From browser Ouput :
<br />
<b>Warning</b>:  Division by zero in <b>Unknown</b> on line <b>0</b><br />

But From Zend Studio's "GO" , Output is nothing...

The correct is nothing output .


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-01 00:39 UTC] kim at openphp dot cn
Small bugs?I don't know.

<?php
  $value = @ (2 / 0);
?>

From browser Ouput :
<br />
<b>Warning</b>:  Division by zero in <b>Unknown</b> on line <b>0</b><br
/>

But From Zend Studio's "GO" (X-Powered-By: PHP/4.3.2) , Output is nothing...

The correct is nothing output .
 [2004-03-02 03:46 UTC] kim at openphp dot cn
The same ....... 
I thank it is different between 4.3.4(or higher) and 4.3.3 .
Or it is different between IIS and Apache .
I haven't tested On IIS/php4.3.4 , but I tested the code on IIS/4.3.3 , everything is OK.

The Error process have something wrong :

-------------------------------------------
<?
error_reporting( E_ALL ^ E_NOTICE  );		//  ???þ??漶??
function myErrorHandler ($errno, $errstr, $errfile, $errline) {
		switch ($errno)
		{
			case E_USER_NOTICE:
			case E_USER_WARNING:
			case E_NOTICE:
			case E_CORE_WARNING:
			case E_CORE_ERROR:
			case E_COMPILE_WARNING:
				break;
			default:
				die("here");
		}
  }
$old_error_handler = set_error_handler("myErrorHandler");
//	mysql_connect ("localhost", "username", "secret");
        
     $ubirth="";
     $arr=explode("-", $ubirth);
     print_r($arr);
     list($year, $month, $day) = explode("-", $ubirth);
    echo checkdate($month, $day, $year);
	echo checkdate(1, 1, 1);
    exit;

?>
---------------------------------------
On IIS5/PHP4.3.3 everything is OK . Output is "Array ( [0] => ) 1"
On Apache2/PHP4.3.4(4.3.5RC4-dev) . Output is "Array ( [0] => ) here".


I don't know why it is different . but it makes me puzzle .
 [2004-03-02 04:09 UTC] kim at openphp dot cn
emm.....the logs is:
checkdate() expects parameter 3 to be long, string given
(PHP 4.3.4 or higher / Apache2.0.48 / Windows Server 2003)
 [2004-03-02 04:45 UTC] derick@php.net
This is not a bug, check_date() gives an E_WARNING error since PHP 4.3.4 in case the parameter passed is not an integer. Because you explode on a string, the first ($year) will contain the string and both $month and $day will contain NULL, which are automatically converted to '0', but the empty string for $year isn't.

This also has nothing to do with your earlier example:
<?php echo @ (2/0); ?> shows no output at all on php 4.3.2, 4.3.3, 4.3.5rc1 and 5.0dev
 [2004-03-02 05:10 UTC] kim at openphp dot cn
Sorry . My English is not good :(
But , 

<?php

$value = @ (2/0);

?>

On PHP4.3.4(or higher) , the output is :

Warning: Division by zero in Unknown on line 0

Not:

This also has nothing to do with your earlier example:
<?php echo @ (2/0); ?> shows no output at all on php 4.3.2, 4.3.3,4.3.5rc1 and 5.0dev
 [2004-03-02 05:21 UTC] derick@php.net
derick@kossu:~$ php-4.3.5RC3 -n -derror_reporting=2047 -r '$value = @ (2/0);';
derick@kossu:~$ php-5.0dev -n -derror_reporting=2047 -r '$value = @ (2/0);';
derick@kossu:~$


no output...
 [2004-03-02 05:54 UTC] kim at openphp dot cn
Oh~My God ! Look At These two Pictures :
http://www.openphp.cn/zero.gif
http://www.openphp.cn/zero2.gif
I don't know how to use CMD ....:)
 [2004-03-12 04:20 UTC] kim at openphp dot cn
OK,$value = @ (2/0); has always output .  On Windows Server 2003 . Some One test it ?

http://www.openphp.cn/zero.gif
http://www.openphp.cn/zero2.gif
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 17:01:27 2025 UTC