File tree 2 files changed +12
-5
lines changed
src/Symfony/Component/Config
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,8 @@ public function getDataForPhpize(): array
169
169
[1 , '1 ' ],
170
170
[-1 , '-1 ' ],
171
171
[0777 , '0777 ' ],
172
+ [-511 , '-0777 ' ],
173
+ ['0877 ' , '0877 ' ],
172
174
[255 , '0xFF ' ],
173
175
[100.0 , '1e2 ' ],
174
176
[-120.0 , '-1.2E2 ' ],
Original file line number Diff line number Diff line change @@ -236,15 +236,11 @@ public static function phpize($value)
236
236
case 'null ' === $ lowercaseValue :
237
237
return null ;
238
238
case ctype_digit ($ value ):
239
- $ raw = $ value ;
240
- $ cast = (int ) $ value ;
241
-
242
- return '0 ' == $ value [0 ] ? octdec ($ value ) : (($ raw === (string ) $ cast ) ? $ cast : $ raw );
243
239
case isset ($ value [1 ]) && '- ' === $ value [0 ] && ctype_digit (substr ($ value , 1 )):
244
240
$ raw = $ value ;
245
241
$ cast = (int ) $ value ;
246
242
247
- return ' 0 ' == $ value[ 1 ] ? octdec ($ value ) : (($ raw === (string ) $ cast ) ? $ cast : $ raw );
243
+ return self :: isOctal ( $ value) ? \intval ($ value, 8 ) : (($ raw === (string ) $ cast ) ? $ cast : $ raw );
248
244
case 'true ' === $ lowercaseValue :
249
245
return true ;
250
246
case 'false ' === $ lowercaseValue :
@@ -281,4 +277,13 @@ protected static function getXmlErrors($internalErrors)
281
277
282
278
return $ errors ;
283
279
}
280
+
281
+ private static function isOctal (string $ str ): bool
282
+ {
283
+ if ('- ' === $ str [0 ]) {
284
+ $ str = substr ($ str , 1 );
285
+ }
286
+
287
+ return $ str === '0 ' .decoct (\intval ($ str , 8 ));
288
+ }
284
289
}
You can’t perform that action at this time.
0 commit comments