php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18073 SetCookie generates error-message with empty string as parameter #3
Submitted: 2002-06-30 15:01 UTC Modified: 2002-06-30 15:10 UTC
From: matslin at orakel dot ntnu dot no Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.2.1 OS: Linux
Private report: No CVE-ID: None
 [2002-06-30 15:01 UTC] matslin at orakel dot ntnu dot no
While the documentation says that the third parameter is optional and can be given with a empty string, the following code does now generate a warning:

<?php
  setcookie('test', '', '');
?>

This changed somewhere between 4.1.2 and 4.2.1.

Since error-output before trying to set the cookie is somewhat problematic (when not using output buffering) this also broke BC in a minor way.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-30 15:10 UTC] sander@php.net
No, the docs say you can skip any argument _except_ expire and secure with an empty string, you should use 0 to skip expire and secure.

From http://www.php.net/manual/en/function.setcookie.php:
"You may also replace any argument with an empty string ("") in order to skip that argument. The expire and secure arguments are integers and cannot be skipped with an empty string. Use a zero (0) instead."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 12:01:27 2024 UTC