|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81609 NO string casting/comparison WITH strict_types=1
Submitted: 2021-11-11 04:13 UTC Modified: 2021-11-11 10:31 UTC
From: gib-o-master at mail dot ru Assigned:
Status: Open Package: *General Issues
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: gib-o-master at mail dot ru
New email:
PHP Version: OS:


 [2021-11-11 04:13 UTC] gib-o-master at mail dot ru
if there is a `declare(strict_types=1);` string to number casting should be avoided, for example:

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


+ 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:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-11 10:31 UTC]
That change would certainly require the RFC process[1].  Maybe you
want to pursue it?

[1] <>
 [2021-11-13 00:55 UTC] gib-o-master at mail dot ru
i'll try
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Dec 05 17:03:50 2022 UTC