@@ -87,14 +87,9 @@ function geoip_detect2_shortcode($attr)
87
87
try {
88
88
if (count ($ properties ) == 1 ) {
89
89
$ return = $ userInfo ->{$ properties [0 ]};
90
- } else if (count ($ properties ) == 2 ) {
91
- $ return = $ userInfo ->{$ properties [0 ]};
92
- if (!is_object ($ return ))
93
- throw new \RuntimeException ('Invalid property name. ' );
94
- $ return = $ return ->{$ properties [1 ]};
95
90
} else if ($ properties [0 ] == 'subdivisions ' && (count ($ properties ) == 2 || count ($ properties ) == 3 )) {
96
91
$ return = $ userInfo ->{$ properties [0 ]};
97
- if (!is_object ($ return ))
92
+ if (!is_array ($ return ))
98
93
throw new \RuntimeException ('Invalid property name. ' );
99
94
if (!is_numeric ($ properties [1 ]))
100
95
throw new \RuntimeException ('Invalid property name (must be numeric, e.g. "subdivisions.0"). ' );
@@ -105,6 +100,11 @@ function geoip_detect2_shortcode($attr)
105
100
throw new \RuntimeException ('Invalid property name. ' );
106
101
$ return = $ return ->{$ properties [2 ]};
107
102
}
103
+ } else if (count ($ properties ) == 2 ) {
104
+ $ return = $ userInfo ->{$ properties [0 ]};
105
+ if (!is_object ($ return ))
106
+ throw new \RuntimeException ('Invalid property name. ' );
107
+ $ return = $ return ->{$ properties [1 ]};
108
108
} else {
109
109
throw new \RuntimeException ('Only 1 dot supported. Please send a bug report to show me the shortcode you used if you need it ... ' );
110
110
}
0 commit comments