PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | libraries/adapter/application/object.php +28 -2 1.6.4 → 1.8.16 View file →
@@ -2,9 +2,9 @@
2 2 /**
3 3 * @package VikWP - Libraries
4 4 * @subpackage adapter.application
5 5 * @author E4J s.r.l.
6 - * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved.
6 + * @copyright Copyright (C) 2023 E4J s.r.l. All Rights Reserved.
7 7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 8 * @link https://vikwp.com
9 9 */
10 10
@@ -97,11 +97,37 @@
97 97 if ($public)
98 98 {
99 99 foreach ($vars as $key => $value)
100 100 {
101 - if ('_' == substr($key, 0, 1))
101 + if (substr($key, 0, 1) === '_')
102 102 {
103 103 unset($vars[$key]);
104 + }
105 + }
106 +
107 + /**
108 + * Collect all none public properties of the current class and it's parents.
109 + * This way, protected and private properties won't be returned.
110 + *
111 + * @since 10.1.68
112 + */
113 + $nonePublicProperties = [];
114 + $reflection = new ReflectionObject($this);
115 +
116 + do {
117 + $nonePublicProperties = array_merge(
118 + $reflection->getProperties(ReflectionProperty::IS_PRIVATE | ReflectionProperty::IS_PROTECTED),
119 + $nonePublicProperties
120 + );
121 + } while ($reflection = $reflection->getParentClass());
122 +
123 + // unset all none public properties, this is needed as get_object_vars returns now all vars
124 + // from the current object and not only the CMSObject and the public ones from the inheriting classes
125 + foreach ($nonePublicProperties as $prop)
126 + {
127 + if (array_key_exists($prop->getName(), $vars))
128 + {
129 + unset($vars[$prop->getName()]);
104 130 }
105 131 }
106 132 }
107 133