|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-10-08 13:34 UTC] nikic@php.net
-Assigned To:
+Assigned To: nikic
[2019-10-08 13:44 UTC] nikic@php.net
[2019-10-08 13:44 UTC] nikic@php.net
-Status: Assigned
+Status: Closed
[2019-10-08 13:52 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 08:00:01 2025 UTC |
Description: ------------ A float property that is defaulted to an integer has the type integer instead of float. I would expect the default integer to be cast to float when assigned to a float type property. Please see provided test script for an example. Test script: --------------- <?php echo 'PHP Version: ' . PHP_VERSION; class Foo { public float $baa = 1; } $instance = new Foo(); echo "\n\nbefore assign\n"; var_dump($instance->baa); var_dump(gettype($instance->baa)); $instance->baa = 1; echo "\n\nafter assign\n"; var_dump($instance->baa); var_dump(gettype($instance->baa)); Expected result: ---------------- PHP Version: 7.4.0RC3 before assign float(1) string(6) "double" after assign float(1) string(6) "double" Actual result: -------------- PHP Version: 7.4.0RC3 before assign int(1) string(7) "integer" after assign float(1) string(6) "double"