Doc #71618 [NEW]: http_response_code() can return bool

From: Date: Wed, 17 Feb 2016 19:05:55 +0000
Subject: Doc #71618 [NEW]: http_response_code() can return bool
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13193@lists.php.net to get a copy of this message
From: dschnepper at box dot com Operating system: Darwin (Macbook) PHP version: 5.6.18 Package: Documentation problem Bug Type: Documentation Problem Bug description:http_response_code() can return bool Description: ------------ --- From manual page: http://www.php.net/function.http-response-code --- $ uname -a Darwin mbp-001898.local 14.5.0 Darwin Kernel Version 14.5.0: Tue Sep 1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64 $ php --version PHP 5.6.18 (cli) (built: Feb 6 2016 06:47:15) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with XCache v3.2.0, Copyright (c) 2005-2014, by mOo with augmented_types v0.6.6, Copyright (c) 2013, by jmarrama@box.com, abishopric@box.com with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans with XCache Cacher v3.2.0, Copyright (c) 2005-2014, by mOo $ cat http.php <?php var_dump(http_response_code()); var_dump(http_response_code(200)); var_dump(http_response_code(302)); var_dump(http_response_code()); var_dump(http_response_code(false)); var_dump(http_response_code()); var_dump(http_response_code(12345678901234567890)); var_dump(http_response_code()); var_dump(http_response_code(-1)); var_dump(http_response_code()); $ php http.php bool(false) bool(true) int(200) int(302) int(302) int(302) int(302) int(-350287872) int(-350287872) int(-1) ---- false is returned when there is no current http_response_code setting. true is returned when there is no current http_response_code setting, but the current call set one. true & false are accepted as input parameters - but ignored. Out of range for valid HTTP values are accepted (-1, large numbers, etc). Test script: --------------- <?php var_dump(http_response_code()); var_dump(http_response_code(200)); var_dump(http_response_code(302)); var_dump(http_response_code()); var_dump(http_response_code(false)); var_dump(http_response_code()); var_dump(http_response_code(12345678901234567890)); var_dump(http_response_code()); var_dump(http_response_code(-1)); var_dump(http_response_code()); Expected result: ---------------- int(200) int(200) int(200) int(302) int(302) int(302) int(302) int(-350287872) int(-350287872) int(-1) Actual result: -------------- bool(false) bool(true) int(200) int(302) int(302) int(302) int(302) int(-350287872) int(-350287872) int(-1) -- Edit bug report at https://bugs.php.net/bug.php?id=71618&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71618&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71618&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71618&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71618&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71618&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71618&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71618&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71618&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71618&r=support Expected behavior: https://bugs.php.net/fix.php?id=71618&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71618&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71618&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71618&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71618&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71618&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71618&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71618&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71618&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71618&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71618&r=mysqlcfg

« previous php.doc.bugs (#13193) next »