Commit 2cfa0d9
Fix chr() deprecation in ASCII85 last-tuple decoding (#793)
Fix chr() deprecation in ASCII85 last-tuple decoding
PR #779 fixed the chr() deprecation warning in the main decoding loop
but missed the "last tuple" switch/case block (lines 233-248) which
handles incomplete groups at the end of the encoded data.
The same issue applies: bit-shifted values ($tuple >> 16, $tuple >> 8)
can exceed 255, triggering:
chr(): Providing a value not in-between 0 and 255 is deprecated
Apply `& 0xFF` bitmask to extract individual bytes, consistent with
the fix in the main loop.
Added test to PHPUnit/Integration/ParserTest.php to load and read demo PDF
Demo PDF would trigger the deprecation warnings without the fixes of
this PR.
---------
Co-authored-by: Konrad Abicht <abicht@mcon-consulting.de>1 parent a606166 commit 2cfa0d9
3 files changed
Lines changed: 16 additions & 4 deletions
File tree
- samples/bugs
- src/Smalot/PdfParser/RawData
- tests/PHPUnit/Integration
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
441 | 453 | | |
442 | 454 | | |
443 | 455 | | |
| |||
0 commit comments