ID: 1830
Updated by: jimw
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Feature/Change Request
Assigned To: 
Comments:

refiled against 4.0.

Previous Comments:
---------------------------------------------------------------------------

[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.



---------------------------------------------------------------------------



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=1830&edit=2


-- 
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]

Reply via email to