ext/xml/expat_compat.h: add missing php.h include#3212
Closed
tpetazzoni wants to merge 1 commit intophp:masterfrom
Closed
ext/xml/expat_compat.h: add missing php.h include#3212tpetazzoni wants to merge 1 commit intophp:masterfrom
tpetazzoni wants to merge 1 commit intophp:masterfrom
Conversation
When expat support is disabled and libxml support is enabled, the following part of the code in expat_compat.h gets used: and therefore "php".h" is included. However, when libexpat support is enabled, HAVE_LIBEXPAT is defined, and therefore the following part of the code is used: In this case, "php.h" is not included. Due to this, zend_alloc.h is never included when building the ext/xmlrpc/libxmlrpc/xml_element.c file, and therefore the estrdup -> _estrdup macros are never defined, causing the following link time failure: ext/xmlrpc/libxmlrpc/xml_element.o: In function `xml_element_serialize': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:462: undefined reference to `efree' ext/xmlrpc/libxmlrpc/xml_element.o: In function `xml_elem_entity_escape': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:347: undefined reference to `emalloc' ext/xmlrpc/libxmlrpc/xml_element.o: In function `_xmlrpc_charHandler': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:646: undefined reference to `efree' ext/xmlrpc/libxmlrpc/xml_element.o: In function `xml_elem_free_non_recurse': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:198: undefined reference to `efree' /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:199: undefined reference to `efree' /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:200: undefined reference to `efree' /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:207: undefined reference to `efree' ext/xmlrpc/libxmlrpc/xml_element.o: In function `xml_elem_new': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:263: undefined reference to `ecalloc' ext/xmlrpc/libxmlrpc/xml_element.o: In function `_xmlrpc_startElement': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:602: undefined reference to `estrdup' /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:607: undefined reference to `emalloc' /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:609: undefined reference to `estrdup' /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:610: undefined reference to `estrdup' ext/xmlrpc/libxmlrpc/xml_element.o: In function `xml_elem_free_non_recurse': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:211: undefined reference to `efree' collect2: error: ld returned 1 exit status make: *** [Makefile:248: sapi/cgi/php-cgi] Error 1 This link time failure can be produced with: ./configure --prefix=/usr --with-libdir=/usr/lib64 --disable-all \ --without-pear --with-config-file-path=/etc --disable-phpdbg \ --disable-cli --enable-cgi --disable-fpm --enable-xmlreader \ --enable-xmlwriter --enable-libxml --enable-wddx --with-xmlrpc \ --with-libexpat-dir=/ We fix it by including "php.h" in the HAVE_LIBEXPAT case. Signed-off-by: Thomas Petazzoni <[email protected]>
Member
|
Thanks for the PR! On a cursory glance this looks like a bug, so would require a ticket in our bug tracker. And if it is indeed a bug, the fix should target the lowest actively supported PHP version (currently, PHP-7.1), which exhibits the erroneous behavior. |
Member
|
@tpetazzoni any action here ? |
Contributor
Author
|
@krakjoe so I need to fill an issue in the bug tracker first ? |
Member
|
Yes, please file a bug report. The changelog will convert the bug number automatically to a link, so users can quickly check whether the bug may affect their code. Also, if the commit message contains the bug number, the bug will automatically be closed as soon as the PR is merged/applied. |
|
Comment on behalf of cmb at php.net: Thanks! Applied via 3691b6d. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When expat support is disabled and libxml support is enabled, the
following part of the code in expat_compat.h gets used:
and therefore "php".h" is included. However, when libexpat support is
enabled, HAVE_LIBEXPAT is defined, and therefore the following part of
the code is used:
In this case, "php.h" is not included. Due to this, zend_alloc.h is
never included when building the ext/xmlrpc/libxmlrpc/xml_element.c
file, and therefore the estrdup -> _estrdup macros are never defined,
causing the following link time failure:
ext/xmlrpc/libxmlrpc/xml_element.o: In function
xml_element_serialize': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:462: undefined reference toefree'ext/xmlrpc/libxmlrpc/xml_element.o: In function
xml_elem_entity_escape': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:347: undefined reference toemalloc'ext/xmlrpc/libxmlrpc/xml_element.o: In function
_xmlrpc_charHandler': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:646: undefined reference toefree'ext/xmlrpc/libxmlrpc/xml_element.o: In function
xml_elem_free_non_recurse': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:198: undefined reference toefree'/home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:199: undefined reference to
efree' /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:200: undefined reference toefree'/home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:207: undefined reference to
efree' ext/xmlrpc/libxmlrpc/xml_element.o: In functionxml_elem_new':/home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:263: undefined reference to
ecalloc' ext/xmlrpc/libxmlrpc/xml_element.o: In function_xmlrpc_startElement':/home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:602: undefined reference to
estrdup' /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:607: undefined reference toemalloc'/home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:609: undefined reference to
estrdup' /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:610: undefined reference toestrdup'ext/xmlrpc/libxmlrpc/xml_element.o: In function
xml_elem_free_non_recurse': /home/thomas/projets/php/ext/xmlrpc/libxmlrpc/xml_element.c:211: undefined reference toefree'collect2: error: ld returned 1 exit status
make: *** [Makefile:248: sapi/cgi/php-cgi] Error 1
This link time failure can be produced with:
./configure --prefix=/usr --with-libdir=/usr/lib64 --disable-all
--without-pear --with-config-file-path=/etc --disable-phpdbg
--disable-cli --enable-cgi --disable-fpm --enable-xmlreader
--enable-xmlwriter --enable-libxml --enable-wddx --with-xmlrpc
--with-libexpat-dir=/
We fix it by including "php.h" in the HAVE_LIBEXPAT case.
Signed-off-by: Thomas Petazzoni [email protected]