Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
d4910ee4
Commit
d4910ee4
authored
Jun 14, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put back Yii::getObjectVars() and fixed infinite loop in Object::toArray().
parent
b184a75d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
YiiBase.php
framework/yii/YiiBase.php
+13
-0
Object.php
framework/yii/base/Object.php
+1
-3
No files found.
framework/yii/YiiBase.php
View file @
d4910ee4
...
...
@@ -624,6 +624,19 @@ class YiiBase
$object
->
$name
=
$value
;
}
}
/**
* Returns the public member variables of an object.
* This method is provided such that we can get the public member variables of an object.
* It is different from "get_object_vars()" because the latter will return private
* and protected variables if it is called within the object itself.
* @param object $object the object to be handled
* @return array the public member variables of the object
*/
public
static
function
getObjectVars
(
$object
)
{
return
get_object_vars
(
$object
);
}
}
YiiBase
::
$aliases
=
array
(
...
...
framework/yii/base/Object.php
View file @
d4910ee4
...
...
@@ -8,7 +8,6 @@
namespace
yii\base
;
use
Yii
;
use
yii\helpers\ArrayHelper
;
/**
* @include @yii/base/Object.md
...
...
@@ -223,11 +222,10 @@ class Object implements Arrayable
/**
* Converts the object into an array.
* The default implementation will return all public property values as an array.
* However, if the object is traversable, it will return the data obtained by the data iteration.
* @return array the array representation of the object
*/
public
function
toArray
()
{
return
ArrayHelper
::
toArray
(
$this
,
false
);
return
Yii
::
getObjectVars
(
$this
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment