File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -430,6 +430,9 @@ public function strip() {
430430 }
431431
432432 public function serialize ($ array ) {
433+ if (!is_array ($ array )) {
434+ $ array = get_object_vars ($ array );
435+ }
433436 foreach ($ array as $ key => $ val ) {
434437 if (array_key_exists ($ key , $ this ->properties ())) {
435438 $ this ->$ key = $ val ;
Original file line number Diff line number Diff line change @@ -435,9 +435,17 @@ public function testResourceReload() {
435435 public function testResourceSerialize () {
436436 $ o = ClassResourceTest::q ('select * from test_user limit 1 ' )->get (0 );
437437 $ o ->serialize ([
438- name => 'new '
438+ name => 'newarray '
439439 ]);
440- $ this ->assertEquals ('new ' , $ o ->name );
440+ $ this ->assertEquals ('newarray ' , $ o ->name );
441+ }
442+
443+ public function testResourceSerializeObject () {
444+ $ o = ClassResourceTest::q ('select * from test_user limit 1 ' )->get (0 );
445+ $ o ->serialize ((object )[
446+ name => 'newobject '
447+ ]);
448+ $ this ->assertEquals ('newobject ' , $ o ->name );
441449 }
442450
443451}
You can’t perform that action at this time.
0 commit comments