seboettg / citeproc-php

Full-featured CSL 1.0.1 processor for PHP
MIT License
73 stars 38 forks source link

Fix PHP 8.1 deprecation notice for implicit conversion from float to int #135

Closed bkosborne closed 1 year ago

bkosborne commented 2 years ago

I'm testing PHP 8.1, and I found that there's a deprecation notice thrown when the Number class attempts to convert a number to an ordinal value:

Deprecated: Implicit conversion from float 0.3 to int loses precision

This happens when trying to render the ordinal value for the "3" edition of a book.

Used CSL stylesheet:

chicago-author-date.csl

Used CSL metadata

array (
  'type' => 'book',
  'author' => 
  array (
    0 => 
    array (
      'category' => 'primary',
      'role' => 'author',
      'family' => 'Lepore',
      'given' => 'Jill ',
      'suffix' => NULL,
      'literal' => 'Jill Lepore',
    ),
  ),
  'title' => 'This America: The Case for the Nation',
  'issued' => 
  array (
    'date-parts' => 
    array (
      0 => 
      array (
        0 => '2019',
      ),
    ),
    'literal' => '2019',
  ),
  'container-title' => 'SomesuchSection',
  'volume' => '42',
  'edition' => '3',
  'number-of-volumes' => '6',
  'number' => '2',
  'page' => '160',
  'publisher' => 'Liveright',
  'publisher-place' => 'Princeton',
  'ISBN' => '1631496417',
  'citation-label' => 'bibcite_1',
  'original-title' => 'CotN',
)