Req #70184 [NEW]: New reserved words for Scalar Types need to be case sensitive
| From: | lauren at laurenblack dot co dot uk | Date: | Sun, 02 Aug 2015 14:15:35 +0000 |
| Subject: | Req #70184 [NEW]: New reserved words for Scalar Types need to be case sensitive | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-194898@lists.php.net to get a copy of this message | ||
From: lauren at laurenblack dot co dot uk
Operating system: CentOS 7
PHP version: 7.0.0beta2
Package: Scripting Engine problem
Bug Type: Feature/Change Request
Bug description:New reserved words for Scalar Types need to be case sensitive
Description:
------------
For PHP 5.3+ we have built a java-like scalar type encapsulation library
to provide scalar type hinting. We designed the library to provide the
full gamut of context related manipulations that the Java type classes
do, as well.
Basically, since the reserved words for the scalar types are case
insensitive, our enpowered Float, Int, String, etc. classes aren't
allowed, which would mean a full rewrite of our libraries.
int =/= Int
float =/= Float
string =/= String
Test script:
---------------
<?php
class Float
{
public $value;
public function __construct (float $float)
{
$this->value = $float;
}
public function multiply(float $float): Float
{
$val = (float) $this->value * $float;
return new Float($val);
}
}
$val1 = new Float(2.5);
echo $val1->multiply(3.2)->value;
Expected result:
----------------
Output: 8
Actual result:
--------------
Fatal error: Cannot use 'Float' as class name as it is reserved in
/var/www/clients/client1/web1/web/test/test.php on line 2
--
Edit bug report at https://bugs.php.net/bug.php?id=70184&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70184&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70184&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70184&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70184&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70184&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70184&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70184&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70184&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70184&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70184&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70184&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70184&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70184&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70184&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70184&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70184&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70184&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70184&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70184&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70184&r=mysqlcfg