Skip to content

Commit

Permalink
Merge pull request #1498 from sjinks/logger
Browse files Browse the repository at this point in the history
[1.3.0] Fix Log Formatter getTypeString EMERGENCY bug
  • Loading branch information
Phalcon committed Nov 1, 2013
2 parents b5b622a + dfe768d commit 7437261
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 1 addition & 2 deletions ext/logger/formatter.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
+------------------------------------------------------------------------+
| Phalcon Framework |
Expand Down Expand Up @@ -70,7 +69,7 @@ PHP_METHOD(Phalcon_Logger_Formatter, getTypeString){
phalcon_fetch_params(0, 1, 0, &type);

itype = phalcon_get_intval(type);
if (itype > 0 && itype < 10) {
if (itype >= 0 && itype < 10) {
RETURN_STRING(lut[itype], 1);
}

Expand Down
11 changes: 11 additions & 0 deletions ext/tests/issue-1498.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--TEST--
Log Formatter getTypeString EMERGENCY bug - https://github.com/phalcon/cphalcon/pull/1498
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
$logger = new \Phalcon\Logger\Adapter\Stream("php://stdout");
$logger->emergence("This is an emergency");
?>
--EXPECTF--
[%s, %d %s %d %d:%d:%d %s][EMERGENCY] This is an emergency

0 comments on commit 7437261

Please sign in to comment.