php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #13216 Removal of redundant function call
Submitted: 2001-09-08 22:31 UTC Modified: 2002-04-27 16:04 UTC
From: Paul dot Hampson at Pobox dot Com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.6 OS: Debian GNU/Linux
Private report: No CVE-ID: None
 [2001-09-08 22:31 UTC] Paul dot Hampson at Pobox dot Com
Since encoded_value is set depending only on whether z_value is NULL(0) or not, surely there's no need to check Z_STRVAL_PP(z_value) before using encoded_value, and it just adds stuff to the normal execution path. At this point, we know either z_value is null, or Z_STRLEN_PP(z_value) is not 0.

--- ext/standard/head.c.cvs     Sun Sep  9 12:13:27 2001
+++ ext/standard/head.c.new     Sun Sep  9 12:32:00 2001
@@ -142,7 +142,7 @@
                sprintf(cookie, "Set-Cookie: %s=deleted; expires=%s", Z_STRVAL_PP(z_name), dt);
                efree(dt);
        } else {
-               sprintf(cookie, "Set-Cookie: %s=%s", Z_STRVAL_PP(z_name), (z_value && Z_STRVAL_PP(z_value)) ? encoded_value : "");
+               sprintf(cookie, "Set-Cookie: %s=%s", Z_STRVAL_PP(z_name), z_value ? encoded_value : "");
                if (expires > 0) {
                        strcat(cookie, "; expires=");
                        dt = php_std_date(expires);

--
Paul "TBBle" Hampson

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-08 22:38 UTC] Paul dot Hampson at Pobox dot Com
Since the webform saw fit to mangle my patch, it's available at <a href="http://www.bubblesworth.com/php4.cvs1.diff">http://www.bubblesworth.com/php4.cvs1.diff</a>

 [2001-09-08 22:38 UTC] Paul dot Hampson at Pobox dot Com
Grr web interface:
http://www.bubblesworth.com/php4.cvs2.diff
 [2001-09-08 22:41 UTC] Paul dot Hampson at Pobox dot Com
Grr idiot at keyboard. (That other patch is for #13217)
http://www.bubblesworth.com/php4.cvs1.diff
 [2002-04-27 16:04 UTC] jimw@php.net
this bit of code has been rewritten.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 01:01:30 2024 UTC