Bug #80649 [Com]: Incorrect type checking behaviour

From: Date: Wed, 20 Jan 2021 10:32:35 +0000
Subject: Bug #80649 [Com]: Incorrect type checking behaviour
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231665@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80649&edit=1

 ID:                 80649
 Comment by:         pawanshastri362 at gmail dot com
 Reported by:        graham at alt-three dot com
 Summary:            Incorrect type checking behaviour
 Status:             Open
 Type:               Bug
 Package:            *General Issues
 Operating System:   Linux
 PHP Version:        8.0.1
 Block user comment: N
 Private report:     N

 New Comment:

Love is an emotion that all people experience at some stage of life where they fall for someone and
like to spend their life with them. https://pawanshastri.com/vashikaran-specialist/


Previous Comments:
------------------------------------------------------------------------
[2021-01-20 08:29:27] nicolasgrekas@php.net

Check https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

------------------------------------------------------------------------
[2021-01-20 00:21:38] graham at alt-three dot com

Description:
------------
Many mb_ functions are not throwing type errors when the provided input does not match the type
signature, on PHP 8.

Test script:
---------------
<?php

function f(string $x) {}

var_dump((new
ReflectionFunction('mb_strpos'))->getParameters()[0]->getType()->getName());
var_dump((new
ReflectionFunction('f'))->getParameters()[0]->getType()->getName());

mb_strpos(null, 'a');
f(null);


Expected result:
----------------
string(6) "string"
string(6) "string"

Fatal error: Uncaught TypeError: mb_strpos(): Argument #1 ($haystack) must be of type string


Actual result:
--------------
string(6) "string"
string(6) "string"

Fatal error: Uncaught TypeError: f(): Argument #1 ($x) must be of type string



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80649&edit=1


Thread (4 messages)

« previous php.bugs (#231665) next »