|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59178 hash_create() not works
Submitted: 2010-04-26 01:48 UTC Modified: 2016-12-31 18:49 UTC
From: Assigned:
Status: Suspended Package: html_parse (PECL)
PHP Version: 5.3.2 OS: Mac OSX 10.5.8
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
New email:
PHP Version: OS:


 [2010-04-26 01:48 UTC]
html_parse not works due to the failure of hash_create() and 
hash_destroy(). The problem may be that on mac osx, php5.3.2 
links certain lib which has the symbols with name 
hash_create()/hash_destroy(). I changed hash_create() and 
hash_destroy() to hash_create2() and hash_destroy2() in 
src/ekhtml.c,src/hash.c,src/hash.h, then it works.

Reproduce code:
function f_data($text) {
   echo "Data: '$text'\n";
$parser = html_parser_create();
html_parser_data_handler($parser, "f_data");
html_parser_parse($parser, "foo <x name='hello' id=23> <!-- <x></x> -->bar </x> baz");

Expected result:
Data: 'foo '
Data: ' '
Data: 'bar '
Data: ' baz'

Actual result:
Program received signal EXC_BAD_ACCESS, Could not access 
Reason: KERN_PROTECTION_FAILURE at address: 0x0000001c
0x027b1af1 in hash_lookup (hash=0x0, hash_key=0xbfffec38) at 
561	    hkey = hash->function(key);		/* 1 */
(gdb) bt
#0  0x027b1af1 in hash_lookup (hash=0x0, 
hash_key=0xbfffec38) at hash.c:561
#1  0x027b0bbd in handle_starttag (parser=0x3550040, 
curp=0x2810a04 "<X name='hello' id=23> <!-- <x></x> -->bar 
</x> bazo \"Start: $tag\";\n", ' ' <repeats 12 times>, 
"}\n\n      function f_end($tag) {\n        echo \"End: 
$tag\\n\";\n      }\n\n      function f_data($text) {\n        
echo \"Data: "..., sstate=0x3550064) at 
#2  0x027b114e in ekhtml_parse_starttag (parser=0x3550040, 
state_data=0x355008c, curp=0xbfffec38 "\005\n?\002\001", 
endp=0x2810a37 "o \"Start: $tag\";\n", ' ' <repeats 12 
times>, "}\n\n      function f_end($tag) {\n        echo 
\"End: $tag\\n\";\n      }\n\n      function f_data($text) 
{\n        echo \"Data: '$text'\\n\";\n      }\n\n      
function f_comment($text"..., baddata=0xbfffed1c) at 
#3  0x027afff5 in ekhtml_parser_flush (parser=0x3550040, 
flushall=0) at ekhtml.c:165
#4  0x027aa934 in zif_html_parser_parse (ht=-1073746888, 
return_value=0x1f3acc0, return_value_ptr=0x0, this_ptr=0x0, 
return_value_used=0) at code/html_parse-1.0.0/html_parse-
#5  0x00383a17 in zend_do_fcall_common_helper_SPEC ()
#6  0x003828a5 in execute ()
#7  0x003548d6 in zend_execute_scripts ()
#8  0x002fb3d3 in php_execute_script ()
#9  0x003e3574 in main ()


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-26 02:20 UTC] surfchen at gmail dot com
ok, just want to let you know the email address was wrong in 
my previous post.Not sure why the system use as my 
default email address.
 [2016-12-31 18:49 UTC]
-Status: Open +Status: Suspended
 [2016-12-31 18:49 UTC]
Apparently, PECL/html_parse is unmaintained, so I'm suspending
this ticket.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 22:01:29 2024 UTC