libxml2 , sablotron combo tested?

php.internals

Adam Dickmeiss

23 years ago
Hi, has anybody tried PHP5 head with the Sablotron , libxml2 combination? The configure would be Something like: './configure' \ '--enable-xslt' \ '--with-xslt-sablot=/usr/local' \ ... -- Adam
-- Adam Dickmeiss mailto:adam@indexdata.dk http://www.indexdata.dk Index Data T: +45 33410100 Mob.: 212 212 66

Adam Dickmeiss

23 years ago
OK, I take it that none have testet it. I for one cannot get it to work reliably. I'm using Apache 1.3.27 (compiled from source), Sablotron 0.98 (compiled from source), libxml2.4.19 (Debian 3.0 package), Expat 1.95.2 (Debian 3.0 package). On Apache startup - when - PHP is loaded the process receives a SEGV in malloc. It is quite hard to trace this one down. valgrind bin/httpd -X shows nothing and actually works! I believe the error is due to the expat compat module conflicting with Sablotron's "own" expat. Sablotron is linked with system wide Expat. And PHP's new Expat compat module defines the same symbols. That, I think, results in bad behaviour. The fix is easy: ensure that Expat compat does not introduce the same symbols as Real expat. The attached patch does that. -- Adam On Mon, May 26, 2003 at 08:39:19PM +0200, Adam Dickmeiss wrote:

Melvyn Sopacua

23 years ago
On Mon, 26 May 2003, Adam Dickmeiss wrote: AD>>> On Apache startup - when - PHP is loaded the process receives a AD>>> SEGV in malloc. AD>>> [ ... ] AD>>> The fix is easy: ensure that Expat compat does not introduce AD>>> the same symbols as Real expat. What happend to --with-expat-dir? That is mandatory with Sablotron. So is --with-iconv-dir, when applicable. The following works for me, with an apache, that has mod_perl and mod_gzip in it as well: #!/bin/sh MAKE=gmake \ CC=/usr/local/bin/gcc \ CPP=cpp \ CFLAGS='-O0' \ ./configure \ --prefix=/php5 \ --enable-debug \ --disable-cgi \ --enable-magic-quotes \ --disable-short-tags \ --enable-bcmath \ --enable-exif \ --enable-mbstring \ --enable-xslt \ --enable-memory-limit \ --with-apache=../../_src/apache_1.3.27 \ --with-dom=/weblib/libxml \ --with-iconv=/weblib/iconv \ --with-mysql=/weblib/mysql \ --with-xslt-sablot=/weblib/sablot \ --with-expat-dir=/weblib/expat \ --with-libxml-dir=/weblib/libxml \ --with-iconv-dir=/weblib/iconv \ --with-sablot-js=/weblib/js A quick test (ext/xslt/tests/xslt_backend_info.phpt) loaded into apache, shows I have iconv and js support. So - AFAIK no patch needed.
-- Melvyn

Adam Dickmeiss

23 years ago
On Tue, May 27, 2003 at 12:53:28AM +0200, Melvyn Sopacua wrote:
> On Mon, 26 May 2003, Adam Dickmeiss wrote: > > AD>>> On Apache startup - when - PHP is loaded the process receives a > AD>>> SEGV in malloc. > AD>>> > > [ ... ] > > AD>>> The fix is easy: ensure that Expat compat does not introduce > AD>>> the same symbols as Real expat. > > What happend to --with-expat-dir? That is mandatory with Sablotron. So > is --with-iconv-dir, when applicable.
--with-libexpat-dir=DIR is for the xml parser. --with-expat=DIR is for Sabltron. --with-expat=DIR is for XMLRPC-EPI. So you are saying that if Sablotron is enabled I cannot use the _default_ xml parser - which in PHP5 uses libxml2? Doesn't seem right to me. My patch allows ext/xml module to use either. iconv is a different story. All modules uses the _same_ / or at least compatible iconv . -- Adam
> The following works for me, with an apache, that has mod_perl and > mod_gzip in it as well: > #!/bin/sh > > MAKE=gmake \ > CC=/usr/local/bin/gcc \ > CPP=cpp \ > CFLAGS='-O0' \ > ./configure \ > --prefix=/php5 \ > --enable-debug \ > --disable-cgi \ > --enable-magic-quotes \ > --disable-short-tags \ > --enable-bcmath \ > --enable-exif \ > --enable-mbstring \ > --enable-xslt \ > --enable-memory-limit \ > --with-apache=../../_src/apache_1.3.27 \ > --with-dom=/weblib/libxml \ > --with-iconv=/weblib/iconv \ > --with-mysql=/weblib/mysql \ > --with-xslt-sablot=/weblib/sablot \ > --with-expat-dir=/weblib/expat \ > --with-libxml-dir=/weblib/libxml \ > --with-iconv-dir=/weblib/iconv \ > --with-sablot-js=/weblib/js > > A quick test (ext/xslt/tests/xslt_backend_info.phpt) loaded into apache, > shows I have iconv and js support. > > So - AFAIK no patch needed. > > -- > Melvyn > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php
-- Adam Dickmeiss mailto:adam@indexdata.dk http://www.indexdata.dk Index Data T: +45 33410100 Mob.: 212 212 66

Melvyn Sopacua

23 years ago
On Tue, 27 May 2003, Adam Dickmeiss wrote: AD>>> So you are saying that if Sablotron is enabled I cannot AD>>> use the _default_ xml parser - which in PHP5 uses libxml2? Nothing new there. Doesn't work in php4 as well. AD>>> Doesn't seem right to me. My patch allows ext/xml module to AD>>> use either. Will the linked expat in Sablotron, not be loaded? Or is it loading, but ext/xml is using a different 'expat'? Reason I ask, is that it can lead to confusion. "When I parse the XML it's loading ok, but when transforming error foo is raised". The truly nice thing, would be if Sablotron would be able to choose it's backend...
-- Melvyn

Adam Dickmeiss

23 years ago
On Tue, May 27, 2003 at 01:43:57AM +0200, Melvyn Sopacua wrote:
> On Tue, 27 May 2003, Adam Dickmeiss wrote: > > AD>>> So you are saying that if Sablotron is enabled I cannot > AD>>> use the _default_ xml parser - which in PHP5 uses libxml2? > > Nothing new there. > Doesn't work in php4 as well.
Except that in php4 ext/xml is only based on Expat. In php5 it is based on libxml2 but _declares_ symbols that match those of Expat.. -- Adam
> AD>>> Doesn't seem right to me. My patch allows ext/xml module to > AD>>> use either. > > Will the linked expat in Sablotron, not be loaded? Or is it loading, but > ext/xml is using a different 'expat'? > > Reason I ask, is that it can lead to confusion. "When I parse the XML > it's loading ok, but when transforming error foo is raised". > > The truly nice thing, would be if Sablotron would be able to choose it's > backend... > > -- > Melvyn > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php
-- Adam Dickmeiss mailto:adam@indexdata.dk http://www.indexdata.dk Index Data T: +45 33410100 Mob.: 212 212 66

Adam Dickmeiss

23 years ago
FWIW, here's a the configure and GDB backtrace. './configure' \ '--with-apxs=/home/adam/proj/apache/bin/apxs' \ '--with-expat-dir=/usr' \ '--with-yaz' \ '--enable-xslt' \ '--with-xslt-sablot=/usr/local/gnu' \ '--prefix=/home/adam/proj/php' \ "$@" (whether --with-expat-dir is given or not, makes no differnce). adam@gamma:~/proj/apache/libexec$ ldd libphp5.so libcrypt.so.1 => /lib/libcrypt.so.1 (0x40173000) libyaz.so.2 => /usr/lib/libyaz.so.2 (0x401a0000) libsablot.so.0 => /usr/local/gnu/lib/libsablot.so.0 (0x4020e000) libexpat.so.1 => /usr/lib/libexpat.so.1 (0x4032a000) libresolv.so.2 => /lib/libresolv.so.2 (0x4034b000) libm.so.6 => /lib/libm.so.6 (0x4035b000) libdl.so.2 => /lib/libdl.so.2 (0x4037c000) libnsl.so.1 => /lib/libnsl.so.1 (0x4037f000) libxml2.so.2 => /usr/lib/libxml2.so.2 (0x40393000) libc.so.6 => /lib/libc.so.6 (0x40432000) libz.so.1 => /usr/lib/libz.so.1 (0x40550000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) adam@gamma:~$ ldd /usr/lib/libyaz.so libz.so.1 => /usr/lib/libz.so.1 (0x40076000) libm.so.6 => /lib/libm.so.6 (0x40085000) libxml2.so.2 => /usr/lib/libxml2.so.2 (0x400a7000) libc.so.6 => /lib/libc.so.6 (0x40146000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) adam@gamma:~/proj/apache$ gdb bin/httpd GNU gdb 2002-04-01-cvs Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-linux"...(no debugging symbols found)... (gdb) run -X Starting program: /home/adam/proj/apache/bin/httpd -X (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)... Program received signal SIGSEGV, Segmentation fault. 0x400dd99b in malloc () from /lib/libc.so.6 (gdb) bt #0 0x400dd99b in malloc () from /lib/libc.so.6 #1 0x400dd074 in malloc () from /lib/libc.so.6 #2 0x40283ec9 in zend_hash_add_or_update (ht=0x402f4e88, arKey=0xbffff5e4 "apache_get_version", nKeyLength=19, pData=0xbffff6fc, nDataSize=112, pDest=0xbffff6f8, flag=2) at /home/adam/proj/php5/Zend/zend_hash.c:233 #3 0x402826d2 in zend_register_functions (scope=0x0, functions=0x402ee7a0, function_table=0x0, type=1) at /home/adam/proj/php5/Zend/zend_API.c:1186 #4 0x40282946 in zend_register_module (module=0x402ee940) at /home/adam/proj/php5/Zend/zend_API.c:1266 #5 0x4028253d in zend_startup_module (module=0x402ee940) at /home/adam/proj/php5/Zend/zend_API.c:1132 #6 0x4024fdd4 in php_startup_extensions (ptr=0xbffff878, count=1) at /home/adam/proj/php5/main/main.c:1222 #7 0x4025024f in php_module_startup (sf=0x402ee600, additional_modules=0x402ee940, num_additional_modules=1) at /home/adam/proj/php5/main/main.c:1392 #8 0x402ad49e in php_apache_startup (sapi_module=0x402ee600) at /home/adam/proj/php5/sapi/apache/mod_php5.c:266 #9 0x402ae1be in php_init_handler (s=0x80b2ac4, p=0x80b2a9c) at /home/adam/proj/php5/sapi/apache/mod_php5.c:889 #10 0x0806dcf4 in ap_init_modules () #11 0x08078596 in standalone_main () #12 0x08078eac in main () #13 0x4008814f in __libc_start_main () from /lib/libc.so.6 -- Adam On Tue, May 27, 2003 at 01:43:57AM +0200, Melvyn Sopacua wrote:
> On Tue, 27 May 2003, Adam Dickmeiss wrote: > > AD>>> So you are saying that if Sablotron is enabled I cannot > AD>>> use the _default_ xml parser - which in PHP5 uses libxml2? > > Nothing new there. > Doesn't work in php4 as well. > > AD>>> Doesn't seem right to me. My patch allows ext/xml module to > AD>>> use either. > > Will the linked expat in Sablotron, not be loaded? Or is it loading, but > ext/xml is using a different 'expat'? > > Reason I ask, is that it can lead to confusion. "When I parse the XML > it's loading ok, but when transforming error foo is raised". > > The truly nice thing, would be if Sablotron would be able to choose it's > backend... > > -- > Melvyn
-- Adam Dickmeiss mailto:adam@indexdata.dk http://www.indexdata.dk Index Data T: +45 33410100 Mob.: 212 212 66

Adam Dickmeiss

23 years ago
Hi, found the cause of the SEGV to be a duplicate fclose on same FILE in ext/yaz which I primarily maintain! Fix has been commited. Thanks for your support, Melvyn. -- Adam On Tue, May 27, 2003 at 01:43:57AM +0200, Melvyn Sopacua wrote:
> On Tue, 27 May 2003, Adam Dickmeiss wrote: > > AD>>> So you are saying that if Sablotron is enabled I cannot > AD>>> use the _default_ xml parser - which in PHP5 uses libxml2? > > Nothing new there. > Doesn't work in php4 as well. > > AD>>> Doesn't seem right to me. My patch allows ext/xml module to > AD>>> use either. > > Will the linked expat in Sablotron, not be loaded? Or is it loading, but > ext/xml is using a different 'expat'? > > Reason I ask, is that it can lead to confusion. "When I parse the XML > it's loading ok, but when transforming error foo is raised". > > The truly nice thing, would be if Sablotron would be able to choose it's > backend... > > -- > Melvyn > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php
-- Adam Dickmeiss mailto:adam@indexdata.dk http://www.indexdata.dk Index Data T: +45 33410100 Mob.: 212 212 66