php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #39665 would like to make a direct call to html_entity_decode() from C/C++
Submitted: 2006-11-28 20:30 UTC Modified: 2006-11-28 20:41 UTC
From: drew at folta dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5.2.0 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: drew at folta dot net
New email:
PHP Version: OS:

 

 [2006-11-28 20:30 UTC] drew at folta dot net
Description:
------------
(Sorry, I didn't know which type of bug to file this as.)

I'm writing a php extension in C++.  I would like to call html_entity_decode() right from C++.  Looking in the source, I see that html_entity_decode() is just a wrapper around php_unescape_html_entities().  Alas, this function is not mentioned in the ext/standard/html.h header file.

This feature request is that the declaration of the php_unescape_html_entities() function be put in the ext/standard/html.h header file.

I *do* have a work-around for this.  If I declare the function myself, than I can use it.  This works well, but is probably bad practice.

Reproduce code:
---------------
#include "ext/standard/html.h"
char *old, *new;
int new_len;
old = estrdup("a&b");
new = php_unescape_html_entities(
   (unsigned char *) old, strlen(old), &new_len, 1,
   ENT_COMPAT, NULL TSRMLS_CC
);
printf("old[%s]  new[%.*s]", old, new_len, new);

Expected result:
----------------
old[a&b]  new[a&b]

Actual result:
--------------
won't compile:
implicit declaration of function `int php_unescape_html_entities(...)'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-28 20:33 UTC] derick@php.net
Do you have a patch?
 [2006-11-28 20:35 UTC] drew at folta dot net
Umm... not generated by diff, but adding this line should be sufficient:
PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char *hint_charset TSRMLS_DC);
 [2006-11-28 20:41 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 21:01:32 2024 UTC