Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use native functions #836

Merged
merged 18 commits into from Jul 12, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Native headers_sent()
  • Loading branch information
sjinks committed Jul 12, 2013
commit 0b66e0f5351f893eaa8c0bedff09956ebb4c0375
8 changes: 4 additions & 4 deletions ext/http/response/cookies.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include "Zend/zend_exceptions.h"
#include "Zend/zend_interfaces.h"

#include "main/SAPI.h"

#include "kernel/main.h"
#include "kernel/memory.h"

Expand Down Expand Up @@ -389,16 +391,14 @@ PHP_METHOD(Phalcon_Http_Response_Cookies, delete){
*/
PHP_METHOD(Phalcon_Http_Response_Cookies, send){

zval *headers_was_sent, *cookies, *cookie = NULL;
zval *cookies, *cookie = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;

PHALCON_MM_GROW();

PHALCON_INIT_VAR(headers_was_sent);
phalcon_call_func(headers_was_sent, "headers_sent");
if (!zend_is_true(headers_was_sent)) {
if (!SG(headers_sent)) {

PHALCON_OBS_VAR(cookies);
phalcon_read_property_this(&cookies, this_ptr, SL("_cookies"), PH_NOISY_CC);
Expand Down
8 changes: 4 additions & 4 deletions ext/http/response/headers.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include "Zend/zend_exceptions.h"
#include "Zend/zend_interfaces.h"

#include "main/SAPI.h"

#include "kernel/main.h"
#include "kernel/memory.h"

Expand Down Expand Up @@ -127,17 +129,15 @@ PHP_METHOD(Phalcon_Http_Response_Headers, setRaw){
*/
PHP_METHOD(Phalcon_Http_Response_Headers, send){

zval *headers_was_sent, *t, *headers, *value = NULL, *header = NULL;
zval *t, *headers, *value = NULL, *header = NULL;
zval *http_header = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;

PHALCON_MM_GROW();

PHALCON_INIT_VAR(headers_was_sent);
phalcon_call_func(headers_was_sent, "headers_sent");
if (!zend_is_true(headers_was_sent)) {
if (!SG(headers_sent)) {

PHALCON_INIT_VAR(t);
ZVAL_BOOL(t, 1);
Expand Down
18 changes: 7 additions & 11 deletions ext/session/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "ext/session/php_session.h"
#endif

#include "main/SAPI.h"

#include "kernel/main.h"
#include "kernel/memory.h"

Expand Down Expand Up @@ -95,23 +97,17 @@ PHP_METHOD(Phalcon_Session_Adapter, __construct){
*/
PHP_METHOD(Phalcon_Session_Adapter, start){

zval *headers_sent;

PHALCON_MM_GROW();

PHALCON_INIT_VAR(headers_sent);
phalcon_call_func(headers_sent, "headers_sent");
if (PHALCON_IS_FALSE(headers_sent)) {
#ifdef HAVE_PHP_SESSION
if (!SG(headers_sent)) {
#if HAVE_PHP_SESSION
php_session_start(TSRMLS_C);
#else
phalcon_call_func_noret("session_start");
phalcon_call_func_ex(NULL, ZEND_STRL("session_start"), 0 TSRMLS_CC)
#endif
phalcon_update_property_bool(this_ptr, SL("_started"), 1 TSRMLS_CC);
RETURN_MM_TRUE;
RETURN_TRUE;
}

RETURN_MM_FALSE;
RETURN_FALSE;
}

/**
Expand Down