Bug #80659 [NEW]: unexp. Typecast at not fitting function return type declaration
| From: | thomas dot bindewald at metanet dot ch | Date: | Fri, 22 Jan 2021 09:54:06 +0000 |
| Subject: | Bug #80659 [NEW]: unexp. Typecast at not fitting function return type declaration | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-231700@lists.php.net to get a copy of this message | ||
From: thomas dot bindewald at metanet dot ch
Operating system: Linux 4.19.0-13-amd64 x86_64 GNU
PHP version: 8.0.1
Package: Class/Object related
Bug Type: Bug
Bug description:unexp. Typecast at not fitting function return type declaration
Description:
------------
Environment: Debian 10 Linux
PHP-Packages from https://packages.sury.org/php/
---
PHP 8.0.1 (cli) (built: Jan 12 2021 13:59:46) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.1, Copyright (c) Zend Technologies
with Zend OPcache v8.0.1, Copyright (c), by Zend Technologies
with Xdebug v3.0.1, Copyright (c) 2002-2020, by Derick Rethans
Test script:
---------------
<?php
âfunction foooo() : false|string|stdClass {
$xmlString =
'<xml><woche><Montag>Erdbeermarmelade</Montag><Dienstag>Lindenbluetenhonig</Dienstag></woche></xml>';
$xmlObj = new SimpleXMLElement($xmlString);
var_dump($xmlObj);
return $xmlObj;
}
â$wert = foooo();
var_dump($wert);
exit;
Expected result:
----------------
TypeError Exception being thrown.
Actual result:
--------------
XML-Object silently being casted to empty string.
--
Edit bug report at https://bugs.php.net/bug.php?id=80659&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80659&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80659&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80659&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80659&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80659&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80659&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80659&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80659&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80659&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80659&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80659&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80659&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80659&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80659&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80659&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80659&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80659&r=mysqlcfg