PHP 4.0 Bug #4154: sapi_starup() uses gcc-only semantic, may break for other compilers
| From: | dolecek at ics dot muni dot cz | Date: | Sat, 15 Apr 2000 21:45:56 +0000 |
| Subject: | PHP 4.0 Bug #4154: sapi_starup() uses gcc-only semantic, may break for other compilers | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-17936@lists.php.net to get a copy of this message | ||
From: dolecek@ics.muni.cz
Operating system: NetBSD (1.4.1 userland, 1.4X kernel)
PHP version: 4.0 Release Candidate 1
PHP Bug Type: Compile Failure
Bug description: sapi_starup() uses gcc-only semantic, may break for other compilers
sapi_startup() uses gcc feature - implicit copying
of whole structures (see the very first line, "sapi_module = *sf).
This is nonstandard feature and should be avoided,
otherwise the code won't be complable with compilers
not supporting this feature.
Patch follow. Note it uses memmove() by purpose -
memmove() is defined as safe v.s. overlapping memory
by ANSI C.
--- SAPI.c.orig Sat Apr 15 22:24:10 2000
+++ SAPI.c Sat Apr 15 22:44:39 2000
@@ -69,7 +69,7 @@
SAPI_API void sapi_startup(sapi_module_struct *sf)
{
- sapi_module = *sf;
+ memmove(&sapi_module, sf, sizeof(sapi_module));
zend_hash_init(&known_post_content_types, 5, NULL, NULL, 1);
sapi_register_post_entries(supported_post_entries);