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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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: Tue Nov 19 20:01:37 2019 UTC