Skip to content
This repository was archived by the owner on Sep 5, 2018. It is now read-only.

Declare a variable explicitly in order to prevent from E_NOTICE #19

Merged
merged 1 commit into from
Apr 1, 2015
Merged
Changes from all commits
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
Declare a variable explicitly in order to prevent from E_NOTICE
aazon committed Apr 1, 2015
commit af257b2040e377df690ed5eb4415087272d399f0
4 changes: 2 additions & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ function wrap($value, $sandbox){
function &wrapByRef(&$value, $sandbox){
if(!($value instanceof SandboxedString) && is_object($value) && method_exists($value, '__toString')){
$strval = $value->__toString();
return is_callable($strval) ? new SandboxedString($strval, $sandbox) : $value;
return is_callable($strval) ? ($_ = new SandboxedString($strval, $sandbox)) : $value;
} else if(is_array($value) && count($value)){
//save current array pointer
$current_key = key($value);
@@ -56,7 +56,7 @@ function &wrapByRef(&$value, $sandbox){
}
return $value;
} else if(is_string($value) && is_callable($value)){
return new SandboxedString($value, $sandbox);
return ($_ = new SandboxedString($value, $sandbox));
}
return $value;
}