Bug #74289 [NEW]: Strange behavior when casting the types of functions/methods

From: Date: Wed, 22 Mar 2017 11:14:33 +0000
Subject: Bug #74289 [NEW]: Strange behavior when casting the types of functions/methods
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207996@lists.php.net to get a copy of this message
From: erickskrauch at yandex dot ru Operating system: Linux PHP version: 7.1.3 Package: Scripting Engine problem Bug Type: Bug Bug description:Strange behavior when casting the types of functions/methods Description: ------------ I'm not sure if this is a bug, but when I was developing a wrapper for xml document, I ran into strange behavior when casting types in the return value of the method. I expect that the asInt() method will work just like the directConversion(), but they work differently. Test script: --------------- https://3v4l.org/JnFCh Expected result: ---------------- string(3) "123" int(123) int(123) int(123) Actual result: -------------- string(3) "123" int(123) int(123) Fatal error: Uncaught TypeError: Return value of Parser::asInt() must be of the type integer, object returned in /in/JnFCh:22 Stack trace: #0 /in/JnFCh(44): Parser->asInt() #1 {main} thrown in /in/JnFCh on line 22 -- Edit bug report at https://bugs.php.net/bug.php?id=74289&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74289&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74289&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74289&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74289&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74289&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74289&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74289&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74289&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74289&r=support Expected behavior: https://bugs.php.net/fix.php?id=74289&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74289&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74289&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74289&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74289&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74289&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74289&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74289&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74289&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74289&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74289&r=mysqlcfg

« previous php.bugs (#207996) next »