File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ function pathinfo(path, options) {
3
3
// original by: Nate
4
4
// revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
5
5
// improved by: Brett Zamir (http://brett-zamir.me)
6
+ // improved by: Dmitry Gorelenkov
6
7
// input by: Timo
7
8
// note: Inspired by actual PHP source: php5-5.2.6/ext/standard/string.c line #1559
8
9
// note: The way the bitwise arguments are handled allows for greater flexibility
@@ -58,7 +59,9 @@ function pathinfo(path, options) {
58
59
} ;
59
60
// PATHINFO_ALL sums up all previously defined PATHINFOs (could just pre-calculate)
60
61
for ( optName in OPTS ) {
61
- OPTS . PATHINFO_ALL = OPTS . PATHINFO_ALL | OPTS [ optName ] ;
62
+ if ( OPTS . hasOwnProperty ( optName ) ) {
63
+ OPTS . PATHINFO_ALL = OPTS . PATHINFO_ALL | OPTS [ optName ] ;
64
+ }
62
65
}
63
66
if ( typeof options !== 'number' ) {
64
67
// Allow for a single string or an array of string flags
@@ -123,12 +126,14 @@ function pathinfo(path, options) {
123
126
// If array contains only 1 element: return string
124
127
cnt = 0 ;
125
128
for ( opt in tmp_arr ) {
126
- cnt ++ ;
129
+ if ( tmp_arr . hasOwnProperty ( opt ) ) {
130
+ cnt ++ ;
131
+ }
127
132
}
128
133
if ( cnt == 1 ) {
129
134
return tmp_arr [ opt ] ;
130
135
}
131
136
132
137
// Return full-blown array
133
138
return tmp_arr ;
134
- }
139
+ }
You can’t perform that action at this time.
0 commit comments