Skip to content

Commit

Permalink
Merge pull request #2841 from sjinks/issue-2840
Browse files Browse the repository at this point in the history
Fix imporper access to \Phalcon\Debug::$_charset
  • Loading branch information
Phalcon committed Sep 23, 2014
2 parents e0e03bd + 6cf9875 commit 4eb3383
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.3.4
- Fix imporper access to \Phalcon\Debug::$_charset (#2840)

1.3.3
- Fix segmentation fault in zim_Phalcon_Http_Request_getBasicAuth (#2819)
- Fix memory corruption on unclean shutdown (#2829)
Expand Down
11 changes: 6 additions & 5 deletions ext/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static const zend_function_entry phalcon_debug_method_entry[] = {
PHP_ME(Phalcon_Debug, getJsSources, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Debug, showTraceItem, NULL, ZEND_ACC_PROTECTED)
PHP_ME(Phalcon_Debug, onUncaughtException, arginfo_phalcon_debug_onuncaughtexception, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Debug, getCharset, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Debug, getCharset, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Phalcon_Debug, setCharset, arginfo_phalcon_debug_setcharset, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Debug, getLinesBeforeContext, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Debug, setLinesBeforeContext, arginfo_phalcon_debug_setlines, ZEND_ACC_PUBLIC)
Expand Down Expand Up @@ -364,7 +364,7 @@ PHP_METHOD(Phalcon_Debug, _escapeString){
zval line_break;
zval escaped_line_break;

charset = phalcon_fetch_nproperty_this(getThis(), SL("_charset"), PH_NOISY TSRMLS_CC);
charset = phalcon_fetch_static_property_ce(phalcon_debug_ce, SL("_charset") TSRMLS_CC);

INIT_ZVAL(line_break);
ZVAL_STRING(&line_break, "\n", 0);
Expand Down Expand Up @@ -948,7 +948,7 @@ PHP_METHOD(Phalcon_Debug, showTraceItem){
PHALCON_INIT_VAR(comment_pattern);
ZVAL_STRING(comment_pattern, "#\\*\\/$#", 1);

charset = phalcon_fetch_nproperty_this(getThis(), SL("_charset"), PH_NOISY TSRMLS_CC);
charset = phalcon_fetch_static_property_ce(phalcon_debug_ce, SL("_charset") TSRMLS_CC);

PHALCON_INIT_VAR(tab);
ZVAL_STRING(tab, "\t", 1);
Expand Down Expand Up @@ -1306,7 +1306,8 @@ PHP_METHOD(Phalcon_Debug, onUncaughtException){
* @return string
*/
PHP_METHOD(Phalcon_Debug, getCharset) {
RETURN_MEMBER(getThis(), "_charset");
zval *charset = phalcon_fetch_static_property_ce(phalcon_debug_ce, SL("_charset") TSRMLS_CC);
RETURN_ZVAL(charset, 1, 0);
}

/**
Expand All @@ -1323,7 +1324,7 @@ PHP_METHOD(Phalcon_Debug, setCharset) {
phalcon_fetch_params_ex(1, 0, &charset);
PHALCON_ENSURE_IS_STRING(charset);

phalcon_update_property_this(getThis(), SL("_charset"), *charset TSRMLS_CC);
phalcon_update_static_property_ce(phalcon_debug_ce, SL("_charset"), *charset TSRMLS_CC);
RETURN_THISW();
}

Expand Down

0 comments on commit 4eb3383

Please sign in to comment.