-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #744 from sjinks/issue-744
[BUG] [CRASH] Segmentation Fault in Phalcon\Tag::setDI() and setDefaults()
- Loading branch information
Showing
2 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
/* | ||
+------------------------------------------------------------------------+ | ||
| Phalcon Framework | | ||
+------------------------------------------------------------------------+ | ||
| Copyright (c) 2011-2012 Phalcon Team (http://www.phalconphp.com) | | ||
+------------------------------------------------------------------------+ | ||
| This source file is subject to the New BSD License that is bundled | | ||
| with this package in the file docs/LICENSE.txt. | | ||
| | | ||
| If you did not receive a copy of the license and are unable to | | ||
| obtain it through the world-wide-web, please send an email | | ||
| to [email protected] so we can send you a copy immediately. | | ||
+------------------------------------------------------------------------+ | ||
| Authors: Andres Gutierrez <[email protected]> | | ||
| Eduar Carvajal <[email protected]> | | ||
+------------------------------------------------------------------------+ | ||
*/ | ||
|
||
class DIDescendant extends Phalcon\DI {} | ||
|
||
class TagTest extends PHPUnit_Framework_TestCase | ||
{ | ||
|
||
public function setUp() | ||
{ | ||
} | ||
|
||
public function testIssue744() | ||
{ | ||
$v = new Phalcon\Tag; | ||
|
||
try { | ||
$v->setDI(0); | ||
$this->assertTrue(false); | ||
} | ||
catch (Exception $e) { | ||
$this->assertTrue(true); | ||
} | ||
|
||
try { | ||
$v->setDI(new stdClass()); | ||
$this->assertTrue(false); | ||
} | ||
catch (Exception $e) { | ||
$this->assertTrue(true); | ||
} | ||
|
||
try { | ||
$v->setDI(new Phalcon\DI()); | ||
$this->assertTrue(true); | ||
} | ||
catch (Exception $e) { | ||
$this->assertTrue(false); | ||
} | ||
|
||
try { | ||
$v->setDI(new DIDescendant()); | ||
$this->assertTrue(true); | ||
} | ||
catch (Exception $e) { | ||
$this->assertTrue(false); | ||
} | ||
|
||
try { | ||
$v->setDefaults(0); | ||
$this->assertTrue(false); | ||
} | ||
catch (Exception $e) { | ||
$this->assertTrue(true); | ||
} | ||
} | ||
} |