Skip to content

Commit

Permalink
Merge pull request yiisoft#1160 from samdark/better-errors-for-passin…
Browse files Browse the repository at this point in the history
…g-non-string-to-cjavascriptexpression

extra check for CJavaScriptExpression constructor
  • Loading branch information
samdark committed Aug 7, 2012
2 parents 99f03ce + b2730f4 commit 9d58b32
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions framework/web/helpers/CJavaScriptExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ class CJavaScriptExpression

/**
* @param string $code a javascript expression that is to be wrapped by this object
* @throws CException if argument is not a string
*/
public function __construct($code)
{
if(!is_string($code))
throw new CException('Value passed to CJavaScriptExpression should be a string.');
$this->code=$code;
}

Expand Down

0 comments on commit 9d58b32

Please sign in to comment.