Req #68530 [Opn->Nab]: Which parameters to send to a function

From: Date: Mon, 01 Dec 2014 20:29:27 +0000
Subject: Req #68530 [Opn->Nab]: Which parameters to send to a function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188876@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68530&edit=1 ID: 68530 Updated by: aharvey@php.net Reported by: ignasimg at gmail dot com Summary: Which parameters to send to a function -Status: Open +Status: Not a bug Type: Feature/Change Request Package: *General Issues Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: You can get that information via reflection, and the documentation includes full change logs for each function detailing when parameters are added, in addition to those changes being noted in the migration guide for that version. Previous Comments: ------------------------------------------------------------------------ [2014-12-01 01:08:36] ignasimg at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=68530&edit=1

« previous php.bugs (#188876) next »