Req #68530 [NEW]: Which parameters to send to a function
| From: | ignasimg at gmail dot com | Date: | Mon, 01 Dec 2014 01:08:37 +0000 |
| Subject: | Req #68530 [NEW]: Which parameters to send to a function | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-188861@lists.php.net to get a copy of this message | ||
From: ignasimg at gmail dot com
Operating system: Irrelevant
PHP version: Irrelevant
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Which parameters to send to a function
Description:
------------
Recently I did a wrapper for JSON_encode and JSON_decode, to deal with
non UTF8 strings aswell, I tested them and didn't had any issue.
The problem came when I uploaded the code to my production server, which
doesn't have the same php version as my development computer.
both JSON_encode and JSON_decode have signatures that added new
parameters quite recently, so my server was expecting those calls with
1/2 parameters and when it seen 3 it went WTF?
I needed that code asap so instead of upgrading my server to the most
recent version I just deleted the noisy parameters from the code (I was
not really using them, just to make the wrappers more convinient in the
future)
But then it came to my mind, it could be of great use a function which
given reference to a function can tell (at least) how many parameters it
expects.
Or even better, named parameters. Would solve funny issues like:
JSON_encode defines options parameter in 5.3.0 and depth in 5.5.0 and
JSON_decode defines options parameter in 5.4.0 and depth in 5.3.0
Anyway just an idea : )
--
Edit bug report at https://bugs.php.net/bug.php?id=68530&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68530&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68530&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68530&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68530&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68530&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68530&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68530&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68530&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68530&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68530&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68530&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68530&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68530&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68530&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68530&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68530&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68530&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68530&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68530&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68530&r=mysqlcfg