ID: 1830 Updated by: sterling Reported By: [EMAIL PROTECTED] Old Status: Open Status: Closed Bug Type: Feature/Change Request Operating System: Linux 2.0.36 (RedHat 5.2) PHP Version: 4.0 New Comment:
Fixed in CVS, thanks. Previous Comments: ------------------------------------------------------------------------ [2001-02-10 13:38:15] [EMAIL PROTECTED] refiled against 4.0. ------------------------------------------------------------------------ [1999-11-11 19:12:39] [EMAIL PROTECTED] While I agree that this is undesirable behavior, I am moving this to a feature request, rather than a misbehaving function, as the intended behavior is correctly taking place. ------------------------------------------------------------------------ [1999-07-22 12:02:08] [EMAIL PROTECTED] Unpack dies with a fatal error if the length of the data does not match the length of the template supplied. I know that this was intended, but it's sort of harsh, don't you think? If you were relying on data from an external source, how would you handle bad data so that your scripts could continue working? The only way I see here is to actually check the data to make sure it's the length of the template. But this is error prone because if you ever changed your template setup, you would need to update your minimum data size. I think the perl way is *much* better. If perl doesn't have enough data for the template, if fills out as many elements as it can and the rest of the array would be empty. That way your script doesn't die in the middle of execution, it just doesn't return quite as much data as you expected. If I had a choice between displaying this to a user: Fatal error: pack type A: not enough input, need 10, have 4 in /home/httpd/html/rpt/btrieve.phtml on line 496 or allowing me to check for missing elements in the array and responding appropriately, I prefer the latter. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=1830&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]