php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61552 Yaf_Reponse_Abstract->setHeader() does nothing
Submitted: 2012-03-29 13:46 UTC Modified: 2020-01-27 15:07 UTC
Votes:2
Avg. Score:3.0 ± 2.0
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: sachin dot nigam at netzero dot net Assigned: cmb (profile)
Status: Closed Package: yaf (PECL)
PHP Version: 5.3.10 OS: Ubuntu Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sachin dot nigam at netzero dot net
New email:
PHP Version: OS:

 

 [2012-03-29 13:46 UTC] sachin dot nigam at netzero dot net
Description:
------------
setHeader() function in Yaf_Response_Abstract is not implemented, I had to change the function to get it to work:

PHP_METHOD(yaf_response, setHeader) {
	char *name,*value;
	uint name_len,value_len = 0;
	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &name, &name_len,&value, &value_len) == FAILURE) {
		RETURN_FALSE;
	}
	sapi_header_line ctr = {0};

	ctr.line_len 		= spprintf(&(ctr.line), 0, "%s: %s", name, value);
	ctr.response_code 	= 0;
	if (sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC) == SUCCESS) {
		efree(ctr.line);
		RETURN_TRUE;
	}
	efree(ctr.line);
	RETURN_FALSE;
}

Test script:
---------------
<?php
class TestController extends Yaf_Controller_Abstract
{
public function indexAction(){
$this->getResponse()->setHeader('max-age',7200);
}
}

Expected result:
----------------
http header should be set when setHeader() is called.

Actual result:
--------------
See above - patch included as part of description.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-02 04:27 UTC] laruence@php.net
actually, this should implement in yaf_response_http(and other header functions), 
and for now, I am working on yaf 2.2, 

so, it will be implemented in 2.2 , thanks :)
 [2012-04-03 05:12 UTC] sachin dot nigam at netzero dot net
Yes, it should be in Yaf_Response_Http :). If my method looks fine, I don't mind adding it as a patch, thanks. Good luck with 2.2 :).
 [2012-04-22 05:30 UTC] laruence@php.net
-Assigned To: +Assigned To: laruence
 [2017-10-24 07:58 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: laruence +Assigned To:
 [2020-01-27 15:07 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-01-27 15:07 UTC] cmb@php.net
This has already been fixed long ago.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC