php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52422 Strange behavior of the function.
Submitted: 2010-07-23 23:32 UTC Modified: 2010-07-24 00:28 UTC
From: g dot kuizinas at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.3 OS: UNIX (CENTOS)
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: g dot kuizinas at gmail dot com
New email:
PHP Version: OS:

 

 [2010-07-23 23:32 UTC] g dot kuizinas at gmail dot com
Description:
------------
There is nothing much to describe actually. I call a function with:
die( hp_mail_wrapper('Subject', 'body') );

And my function looks like this:
function hp_mail_wrapper($title, $body, $theme = 0, $vars = array())
{
	if($theme == 'newsletter')
	{
		die('What???');
	}

	die('Good');
}

Strangely enough script dies with 'What???'. If I change $theme = 0 to anything else, like NULL, FALSE (anything), it works fine. I also dumped the incoming args to avoid reporting a sleepy-bug, but as expected, the only variables that function get is $title and $body.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-24 00:17 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2010-07-24 00:17 UTC] felipe@php.net
Hi, this is because 'newsletter' is converted to integer zero.

See http://docs.php.net/manual/en/types.comparisons.php
 [2010-07-24 00:20 UTC] g dot kuizinas at gmail dot com
I do realize this. However, should this be an expected behavior? I mean, it is quite tricky and many people may get lost.
 [2010-07-24 00:28 UTC] felipe@php.net
Yes, It's expected and how PHP handle the types since the begin.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Dec 21 11:00:02 2025 UTC