php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71363 No documentation on E_NOTICE for trailing characters with weak int/float hints
Submitted: 2016-01-13 23:44 UTC Modified: 2016-01-13 23:58 UTC
From: benjamin dot morel at gmail dot com Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 7.0.2 OS: Fedora 23
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: benjamin dot morel at gmail dot com
New email:
PHP Version: OS:

 

 [2016-01-13 23:44 UTC] benjamin dot morel at gmail dot com
Description:
------------
When using scalar type hinting, some malformed integers report a TypeError, while others raise a E_NOTICE.

Test script:
---------------
function test(int $a) {}

test(null); // TypeError
test("x"); // TypeError
test("x1"); // TypeError
test("1x"); // E_NOTICE

Expected result:
----------------
test("1x"); // TypeError

Actual result:
--------------
test("1x"); // E_NOTICE

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-13 23:58 UTC] requinix@php.net
-Summary: Inconsistent handling of malformed integers +Summary: No documentation on E_NOTICE for trailing characters with weak int/float hints -Type: Bug +Type: Documentation Problem
 [2016-01-13 23:58 UTC] requinix@php.net
See https://wiki.php.net/rfc/scalar_type_hints#behaviour_of_weak_type_checks

I don't see any mention of the potential for notices on the function arguments page...
http://php.net/manual/en/functions.arguments.php
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Nov 14 06:01:35 2019 UTC