-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
Environment
- PHP: 7.2.14 (cli) ( ZTS )
- decimal: 1.1.1
- pthreads: 3.2.0 (http://php.net/manual/en/book.pthreads.php / https://github.com/krakjoe/pthreads)
- libmpdec: 2.4.2
- OS: docker, debian:stretch
Summary
Without threads, operations work as expected.
As soon as operations are performed in a seperate thread, some result in "INF".
Reproducing Code
<?php
$thread = new class() extends Thread {
public function run() {
var_dump((new Decimal\Decimal("1"))->mul("9"));
var_dump((new Decimal\Decimal("1"))->mul("10"));
}
};
$thread->start() && $thread->join();
?>
Expected Output
object(Decimal\Decimal)#39 (2) {
["value"]=>
string(1) "9"
["precision"]=>
int(28)
}
object(Decimal\Decimal)#42 (2) {
["value"]=>
string(2) "10"
["precision"]=>
int(28)
}
Actual Output
object(Decimal\Decimal)#3 (2) {
["value"]=>
string(1) "9"
["precision"]=>
int(28)
}
PHP Warning: Loss of data on string conversion in /app/test.php on line 7
object(Decimal\Decimal)#2 (2) {
["value"]=>
string(3) "INF"
["precision"]=>
int(28)
}
Metadata
Metadata
Assignees
Labels
No labels