Re: backtrace
| From: | Zeev Suraski | Date: | Thu, 31 Aug 2000 18:30:34 +0000 |
| Subject: | Re: backtrace | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-31481@lists.php.net to get a copy of this message | ||
At 21:22 31-08-00, Sascha Schumann wrote:
On Thu, 31 Aug 2000, Zeev Suraski wrote: At 18:33 31-08-00, Sascha Schumann wrote:A va_list cannot be traversed multiple times, which is why the code was originally there (I think). What you meant is that if you send a va_list to a function (by value), that function can obviously not modify it. Thus, the code in php_error was redundant.On Thu, 31 Aug 2000, Stanislav Malyshev wrote:Actually, the original version was quite alright, except for under very weird platforms, which define va_list as a type that cannot be copied (probably some sort of an array).j>> called with a null list of var_args, which is causing it to barf. j>> Problem is, the variable orig_args is being cleared on line 369 j>> (va_end()), and j>> then being reused on line 444. Sorry, don't see any va_end in current CVS.The old_args stuff was removed some weeks ago (if we are talking about main/main.c). The author of the original code did not seem to be aware of the correct va_args use.It was not necessary at all to copy it. That is where I saw the basic misunderstanding. A va_list can be traversed multiple times without copying it.
And if there would have been any need to copy it, the macro
va_copy should have been used.
va_copy() is not portable.
But admittedly, while fixing the standard compliance, I broke
some other odd configurations :(
Many platforms that define va_list as a simple pointer, reset it to NULL on va_end(), which makes it useless afterwards. Others don't do anything. Anyway, shit happens, this time it happened to both of us, but I hope we got it right this time (even though theoretically, it could still be broken under some implementations, but I don't think such implementations exist).
Zeev
--
Zeev Suraski <zeev@zend.com>
http://www.zend.com/