Re: bug report...
| From: | Zeev Suraski | Date: | Sun, 18 Jul 1999 23:53:05 +0000 |
| Subject: | Re: bug report... | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-8687@lists.php.net to get a copy of this message | ||
At 00:44 19/07/99 , Rasmus Lerdorf wrote:
There's this new _IO_new_fclose() again. What platform is this? My guess is that it is a Linux box with a broken glibc-2.1.1 library (ie. RH6). Stig and I chased this one down a while ago. Well, I did the chasing, Stig did the fixing.. ;) As far as I recall, it is a weird one. It only happens when PHP is loaded as a DSO. What happens is that when you pass a pointer to a libc function (as we do when we register fclose() as the destructor for open files) and then try to call this function from that pointer, something in libc trashes the stack. Our workaround was to change this: GLOBAL(le_fp) = register_list_destructors(fclose,NULL); to this: static void php3i_destructor_fclose(FILE *fp) {Weird indeed. The problem Sascha was (is) experiencing with source highlight seems to be related, if not identical. There, it seems that for some reason, a FILE * pointer that was obtained with fdopen(), was causing a crash when closed with fclose(). I traced it with a debugger, and saw that instead of fclose(), a function called _IO_old_fclose() was being called (the code said fclose()). I tried checking whether fclose() and _IO_old_fclose() have the same addresses - they don't, they're two separate functions. I tried calling fclose() directly in the debugger - that seemed to call the real fclose() (and not _IO_old_fclose()) - which worked flawlessly. I checked it further - there seems to be an entire family of _IO_old_*() functions; My guess is that if the FILE * was obtained using _IO_old_fdopen() (which exists, but doesn't get called; the real fdopen() does), _IO_old_fclose() would have worked on it. Somehow, some of the code gets to use the standard functions, and the other gets to use the _IO_old_*() functions. The big question is where are these _IO_old_*() functions and _IO_new_*() functions coming from, and why does it happen with APXS only. Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/ For a PGP public key, finger bourbon@netvision.net.il(void)fclose(fp);} GLOBAL(le_fp) = register_list_destructors(php3i_destructor_fclose,NULL); Looks weird, I know, but it actually fixed it. I don't see it in the ChangeLog, but we did this in early June so it went into either 3.0.9 or 3.0.10. My guess is that this guy is using an earlier version.