Bug #71100 [Asn->Wfx]: long2ip() doesn't accept integers in strict mode

From: Date: Sun, 13 Dec 2015 05:32:57 +0000
Subject: Bug #71100 [Asn->Wfx]: long2ip() doesn't accept integers in strict mode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197843@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71100&edit=1 ID: 71100 Updated by: laruence@php.net Reported by: anthonyryan1 at gmail dot com Summary: long2ip() doesn't accept integers in strict mode -Status: Assigned +Status: Wont fix Type: Bug Package: *Network Functions Operating System: Linux PHP Version: 7.0.0 Assigned To: laruence Block user comment: N Private report: N New Comment: hmm, changing long2ip accept integer instead of string will break something in non strict_types like: long2ip(""); thus I will only fixed this in master Previous Comments: ------------------------------------------------------------------------ [2015-12-12 06:35:49] laruence@php.net That is why it cause "strict_types" from doc: string long2ip ( string $proper_address ) and int ip2long ( string $ip_address ) it's better we change long2ip accept long instead of string. anyway, this is a little similar with #71053, I will also considered this case thanks ------------------------------------------------------------------------ [2015-12-12 06:21:51] anthonyryan1 at gmail dot com Description: ------------ long2ip()'s expected input type does not match up with the output type of ip2long(), in strict mode passing an integer causes a TypeError to be thrown. Test script: --------------- <?php declare(strict_types=1); var_dump(long2ip(ip2long('127.0.0.1'))); Expected result: ---------------- long2ip()'s expected input type to be an integer in strict mode. Actual result: -------------- PHP Fatal error: Uncaught TypeError: long2ip() expects parameter 1 to be string, integer given in test-script.php:4 Stack trace: #0 test-script.php(4): long2ip(2130706433) #1 {main} thrown in test-script.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71100&edit=1

« previous php.bugs (#197843) next »