Hello,
I just have a question, often there are 'optional' parameters to
functions, I've always thought that most of the time I could pass null
to these if I wanted to leave one empty. This has as far as I can tell
always worked except recently I was using substr()
. If I pass null to
the third param, I get nothing back. Isn't passing null the same as not
passing anything? Is this a bug? Or is my logic flawed?
--
Nathanael d. Noblet
Gnat Solutions, Inc
T: 403.875.4613
Nathanael D. Noblet wrote:
Hello,
I just have a question, often there are 'optional' parameters to
functions, I've always thought that most of the time I could pass null
to these if I wanted to leave one empty. This has as far as I can tell
always worked except recently I was usingsubstr()
. If I pass null to
the third param, I get nothing back. Isn't passing null the same as not
passing anything? Is this a bug? Or is my logic flawed?
I know Ilia recently fixed a few functions that didn't ignore null
parameters, but it doesn't appear that substr()
was one of them.
Triple check the problem reproduces with the latest snapshot
(snaps.php.net). If it's still broken then log a bug (bugs.php.net).
Chris
--
Email: christopher.jones@oracle.com Tel: +1 650 506 8630
Twitter: http://twitter.com/ghrd Free PHP Book: http://tinyurl.com/UGPOM
Hi,
Nathanael D. Noblet wrote:
Hello,
I just have a question, often there are 'optional' parameters to
functions, I've always thought that most of the time I could pass null
to these if I wanted to leave one empty. This has as far as I can tell
always worked except recently I was usingsubstr()
. If I pass null to
the third param, I get nothing back. Isn't passing null the same as not
passing anything? Is this a bug? Or is my logic flawed?I know Ilia recently fixed a few functions that didn't ignore null
parameters, but it doesn't appear thatsubstr()
was one of them.
I guess that's part of the zend_parse_parameters changes. As we now use
the "s" modifier for instance which might better be a "s!". We should
certainly spent some time on checking these things.
All remember: We're feature freezing, so spend time on finding and
fixing bugs instead of adding new ones! :-)
(this includes users who can at least report such issues ... )
johannes