php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30660 Using Tidy as shared extension crashes PHP (CLI)
Submitted: 2004-11-02 13:26 UTC Modified: 2005-03-22 09:06 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: margus at zone dot ee Assigned: john (profile)
Status: Closed Package: Tidy (PECL)
PHP Version: 5.0.2 OS: SuSe Linux 9.0
Private report: No CVE-ID: None
 [2004-11-02 13:26 UTC] margus at zone dot ee
Description:
------------
When building and using Tidy extension separately as shared module, then PHP-CLI crashes at the end.

Everything seems to work, when compiling the extension directly into PHP binary.

Reproduce code:
---------------
build LIBTIDY:
- /bin/sh build/gnuauto/setup.sh
- ./configure --with-prefix=/usr
- make
- make install
- ldconfig

build PHP5 (5.0.2):
- ./configure --with-tidy=shared,/usr
- make

changes in PHP.INI:
extension_dir=.

script tidytest.php:
<?php
  dl ('modules/tidy.so');

  $tidy = tidy_parse_string ("<HTML></HTML>");

  echo "Exiting...";
?>

Expected result:
----------------
Exiting...

Actual result:
--------------
Exiting...Segmentation Fault

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-02 13:34 UTC] margus at zone dot ee
<?php
  dl ('modules/tidy.so');

  $tidy = tidy_parse_string ("<HTML></HTML>");

  echo "Exiting...";
?>
 [2004-11-02 14:23 UTC] margus at zone dot ee
linux:/home/margus/install/php-5.0.2 # gdb sapi/cli/php 
GNU gdb 5.3.92
Copyright 2003 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 "i586-suse-linux"...
(gdb) run -c . tidytest.php
Starting program: /home/margus/install/php-5.0.2/sapi/cli/php -c . tidytest.php
[New Thread 16384 (LWP 21668)]
Exiting...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 21668)]
0x0816a055 in _zval_dtor (zvalue=0x826ad1c) at /home/margus/install/php-5.0.2/Zend/zend_variables.c:61
61                                      Z_OBJ_HT_P(zvalue)->del_ref(zvalue TSRMLS_CC);
(gdb) bt
#0  0x0816a055 in _zval_dtor (zvalue=0x826ad1c) at /home/margus/install/php-5.0.2/Zend/zend_variables.c:61
#1  0x08161e89 in _zval_ptr_dtor (zval_ptr=0x826fe48) at /home/margus/install/php-5.0.2/Zend/zend_execute_API.c:394
#2  0x081715e9 in zend_hash_apply_deleter (ht=0x81ea6d0, p=0x826fe3c) at /home/margus/install/php-5.0.2/Zend/zend_hash.c:574
#3  0x08171679 in zend_hash_graceful_reverse_destroy (ht=0x81ea6d0) at /home/margus/install/php-5.0.2/Zend/zend_hash.c:640
#4  0x08161944 in shutdown_executor () at /home/margus/install/php-5.0.2/Zend/zend_execute_API.c:210
#5  0x0816b126 in zend_deactivate () at /home/margus/install/php-5.0.2/Zend/zend.c:818
#6  0x081395c7 in php_request_shutdown (dummy=0x0) at /home/margus/install/php-5.0.2/main/main.c:1212
#7  0x081987d0 in main (argc=4, argv=0xbffff704) at /home/margus/install/php-5.0.2/sapi/cli/php_cli.c:1046
(gdb)
 [2004-11-08 12:34 UTC] john@php.net
I'll look into it, hopefully I'll be able to reproduce it in RH
 [2004-12-03 18:29 UTC] brent at jeneral dot com
I have two systems w/ apparently identical software systems--FreeBSD 5.2.1 with the same ported application versions (PHP 5.0.2).  One fails the simple test as identified in the notes below and the other works perfectly.  I do not see any software differences between the systems, only hardware differences.  Unfortunately, the failing system is the production box.
 [2005-03-14 22:43 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-03-22 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-03-22 09:06 UTC] margus at zone dot ee
Looks great! I tested snapshot php5-200503220530 and segfault is now gone.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 09:01:26 2024 UTC