Bug #77287 [NEW]: Fatal error: Uncaught TypeError

From: Date: Wed, 12 Dec 2018 08:33:08 +0000
Subject: Bug #77287 [NEW]: Fatal error: Uncaught TypeError
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218408@lists.php.net to get a copy of this message
From:             someone dot is dot alive at gmail dot com
Operating system: Windows
PHP version:      7.3.0
Package:          Unknown/Other Function
Bug Type:         Bug
Bug description:Fatal error: Uncaught TypeError

Description:
------------
Function has 2 arguments. 2nd has a default value. When calling a
function it returns an fatal error instead passing second argument as a
default value.

Test script:
---------------
Test case is available in zip
https://www.jerc.si/wp-content/uploads/2018/12/php7.3.zip
Contains:
- index.php
- init.php (load files)
- PHPDemo/Utils.php (echo's few lines)
- PHPDemo/TestConst.php (simple class instance)

Short preview:
public static function testInput(string $name, int $step =
TestConst::STEP_1)
Utils::testInput('abc 1');
Utils::testInput('abc 2', TestConst::STEP_2);
Utils::testInput('abc 3');

Expected result:
----------------
Based on a code in ZIP file.
"Hello world! abc 3 > 1
yes"

Actual result:
--------------
TypeError: Argument 2 passed to PHPDemo\Utils::testInput() must be of
the type int, unknown given, called in D:\www\index.php on line 10 in
D:\www\PHPDemo\Utils.php on line 6

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



Thread (18 messages)

« previous php.bugs (#218408) next »