File: opcache.phpt

package info (click to toggle)
php-decimal 1.5.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 456 kB
  • sloc: ansic: 1,928; xml: 102; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 843 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--TEST--
Disable OPcache pass 2
--SKIPIF--
<?php
if (!function_exists("opcache_get_status")) echo "skip";
?>
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=2
--FILE--
<?php

/**
 * Test that opcache does not convert these constant strings to float.
 */
$number = new \Decimal\Decimal(1);

$number = $number *  "0.1";
$number = $number *  "0.0000123456789";
$number = $number *  "12345.6789";
$number = $number * "-98765.4321";
$number = $number *  "9.87654321";
$number = $number * "-1.23456789";
$number = $number *  "0.00000000123456789";
$number = $number * "-0.00000000123456789";
$number = $number *  "12345.6789";
$number = $number * "-12345.6789";

var_dump($number);

?>
--EXPECT--
object(Decimal\Decimal)#1 (2) {
  ["value"]=>
  string(35) "0.000004263976243931729575375414851"
  ["precision"]=>
  int(28)
}