Req #81609 [NEW]: NO string casting/comparison WITH strict_types=1

From: Date: Thu, 11 Nov 2021 04:13:30 +0000
Subject: Req #81609 [NEW]: NO string casting/comparison WITH strict_types=1
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237676@lists.php.net to get a copy of this message
From:             gib-o-master at mail dot ru
Operating system: 
PHP version:      Irrelevant
Package:          *General Issues
Bug Type:         Feature/Change Request
Bug description:NO string casting/comparison WITH strict_types=1

Description:
------------
if there is a declare(strict_types=1); string to number casting should
be avoided, for example:

var_dump('20' < '3');// is false

Pros/Cons:

+ it will be faster (no if string is a number check, no casting)
+ it will be common (with strings, compat with other langs like JS,
Python)
+ it will be more error prone (because it's common)

- some old code which rely on this feature will break (does it exist?)









Test script:
---------------
var_dump('20' < '3');

Expected result:
----------------
true

Actual result:
--------------
false

-- 
Edit bug report at https://bugs.php.net/bug.php?id=81609&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81609&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81609&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81609&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81609&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81609&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81609&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81609&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81609&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81609&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81609&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81609&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81609&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81609&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81609&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81609&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81609&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81609&r=mysqlcfg


Thread (4 messages)

« previous php.bugs (#237676) next »