[PHP-DEV] Re: [PATCH][ZE2] zend_highlight.c change
Hi, At the very least, the portion that adds in \n to is necessary to fix a bug in Internet Explorer experienced by PEAR documentation users. The source code examples in the manual at pear.php.net are highlighted with highlight_string(), and the lack of \n causes the rendered page examples (not HTML source - viewable graphical text) to cut-and-paste as a single line, something very annoying to deal with. Regards, Greg Lisa Seelye wrote: Attached is a patch to change the behavior of source highlighting functions to use instead of . This patch also introduces \n and \t when the parser encounters one (this change is mainly for readability). The reasoning is: the tag is depreciated[1], and \n and \t should be preserved, and not just translated into and 's (respectively). [1]: http://www.w3.org/TR/html4/present/graphics.html#edef-FONT Please CC me on replies. --- cvs/ZendEngine2/zend_highlight.c 2003-08-11 01:24:41.0 -0400 +++ cvs-diff/ZendEngine2/zend_highlight.c 2003-10-28 14:05:59.0 -0500 @@ -30,7 +30,7 @@ { switch (c) { case '\n': - ZEND_PUTS(""); + ZEND_PUTS("\n"); break; case '<': ZEND_PUTS("<"); @@ -45,7 +45,7 @@ ZEND_PUTS(" "); break; case '\t': - ZEND_PUTS(""); + ZEND_PUTS("\t"); break; default: ZEND_PUTC(c); @@ -104,8 +104,8 @@ char *next_color; int in_string=0; - zend_printf(""); - zend_printf("\n", last_color); + zend_printf("\n"); + zend_printf("\n", last_color); /* highlight stuff coming back from zendlex() */ token.type = 0; while ((token_type=lex_scan(&token TSRMLS_CC))) { @@ -151,11 +151,11 @@ if (last_color != next_color) { if (last_color != syntax_highlighter_ini->highlight_html) { -zend_printf(""); +zend_printf(""); } last_color = next_color; if (last_color != syntax_highlighter_ini->highlight_html) { -zend_printf("", last_color); +zend_printf("", last_color); } } switch (token_type) { @@ -192,10 +192,10 @@ token.type = 0; } if (last_color != syntax_highlighter_ini->highlight_html) { - zend_printf("\n"); + zend_printf("\n"); } - zend_printf("\n"); - zend_printf(""); + zend_printf("\n"); + zend_printf("\n"); } @@ -264,4 +264,3 @@ * indent-tabs-mode: t * End: */ - -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: header() behaviour
On Wed, 29 Oct 2003, Christian Schneider wrote: > Gareth Ardron wrote: > > $var = "foo=1&bar=2"; > > To clarify: > You should use $var = "foo=1&bar=2"; and then $var for header() but > htmlspecialchar($var) for your href: > - HTTP-Headers must not be html-encoded. > - HTML-Attributes on the other hand have to be html-encoded. > > Even though most browsers work with hrefs without html-encoding and some > browsers might understand & in HTTP-Headers this is not conforming > to the standards. Actually, & is the way you need to write it if you are going to be perfectly standards-compliant. It's just that nobody does this. You can make PHP understand this by setting the separator in your php.ini file to & -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: header() behaviour
Gareth Ardron wrote: $var = "foo=1&bar=2"; To clarify: You should use $var = "foo=1&bar=2"; and then $var for header() but htmlspecialchar($var) for your href: - HTTP-Headers must not be html-encoded. - HTML-Attributes on the other hand have to be html-encoded. Even though most browsers work with hrefs without html-encoding and some browsers might understand & in HTTP-Headers this is not conforming to the standards. - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] header() behaviour
Zitat von Tal Peer <[EMAIL PROTECTED]>: > On Tue, 28 Oct 2003, Gareth Ardron wrote: > > > I can't figure out if this is desired or not, if it's not, I'll happily > > draft up a patch to alter the behaviour - I just want to make sure > > before I do. > > Why should header() start parsing its argument? its only job is to add > its > argument to the HTTP headers, nothing more, nothing less. > It's the browser job to parse the & entity into the character '&'. Beside that, HTTP headers have nothing to do with XHTML, so this behaviour is absolutely correct. Jan. -- http://www.horde.org - The Horde Project http://www.ammma.de - discover your knowledge http://www.tip4all.de - Deine private Tippgemeinschaft -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] header() behaviour
On Tue, 28 Oct 2003, Gareth Ardron wrote: > I can't figure out if this is desired or not, if it's not, I'll happily > draft up a patch to alter the behaviour - I just want to make sure > before I do. Why should header() start parsing its argument? its only job is to add its argument to the HTTP headers, nothing more, nothing less. It's the browser job to parse the & entity into the character '&'. -- Tal Peer Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x253D2947 Key Fingerprint: C0B1 D91D 7323 6C0F 227A CBD6 D635 E53D 253D 2947 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH][ZE2] zend_highlight.c change
On Tue, 2003-10-28 at 15:10, [EMAIL PROTECTED] wrote: > In your diff, you have this line: + zend_printf(" %s\";>\n", last_color); > > There's a semicolon (;) in the tag (marked in red, if > available). If that was meant to be part of the style attribute (like > style=\"color: %s;\">), then it is in the wrong place. And also, if > that is the place it's supposed to be, then you missed one on > the +zend_printf("", last_color); line. Yes quite right on missing the last semicolon. Truly having it there or not is personal preference. My preference is to use semicolons at the end of each style definition, but since in this context the user can't add any additional styles then it makes sense to omit it. -- Regards, -Lisa signature.asc Description: This is a digitally signed message part
Re: [PHP-DEV] internal hashtables [patch included]
Derick Rethans wrote: Can you please not send uuencoded stuff but just attach the files as plain text? Sorry Derick, I didn't mean to. :-( The patch is attached as plain text now. Cristiano Duarte ? php-src/ZendEngine1 Index: php-src/Zend/zend_alloc.c === RCS file: /repository/ZendEngine2/zend_alloc.c,v retrieving revision 1.129 diff -u -r1.129 zend_alloc.c --- php-src/Zend/zend_alloc.c 17 Oct 2003 02:29:06 - 1.129 +++ php-src/Zend/zend_alloc.c 26 Oct 2003 16:57:39 - @@ -477,6 +477,10 @@ zend_uint grand_total_leaks=0; #endif + if (zend_internal_nOfHashTables() > 0) { + zend_gc_destroy_internal_hashtables(); + } + #if defined(ZEND_MM) && !ZEND_DEBUG if (clean_cache) { zend_mm_shutdown(&AG(mm_heap)); Index: php-src/Zend/zend_hash.c === RCS file: /repository/ZendEngine2/zend_hash.c,v retrieving revision 1.113 diff -u -r1.113 zend_hash.c --- php-src/Zend/zend_hash.c29 Aug 2003 07:34:37 - 1.113 +++ php-src/Zend/zend_hash.c26 Oct 2003 16:57:40 - @@ -1313,6 +1313,48 @@ } #endif +struct _internal_hashtables { + HashTable **list; + int nOfHashTables; +}; +struct _internal_hashtables *internal_hashtables = NULL; + +int zend_internal_nOfHashTables() { + return (internal_hashtables == NULL) ? 0 : internal_hashtables->nOfHashTables; +} + +void zend_gc_add_internal_hashtable(HashTable *ht TSRMLS_DC) { + HashTable **ptr; + if (internal_hashtables == NULL) { + internal_hashtables = malloc(sizeof(struct _internal_hashtables)); + internal_hashtables->nOfHashTables = 0; + internal_hashtables->list = NULL; + } + internal_hashtables->list = realloc(internal_hashtables->list, sizeof(HashTable*) * (internal_hashtables->nOfHashTables + 1)); + ptr = internal_hashtables->list; + ptr += internal_hashtables->nOfHashTables; + *ptr = ht; + ++(internal_hashtables->nOfHashTables); +} + +void zend_gc_destroy_internal_hashtables() { + HashTable **ptr; + if (internal_hashtables != NULL) { + ptr = internal_hashtables->list; + if (ptr != NULL) { + int i; + for (i = 0; i < internal_hashtables->nOfHashTables; ++i) { + zend_hash_destroy(*ptr); + ++ptr; + } + free(internal_hashtables->list); + internal_hashtables->list = NULL; + free(internal_hashtables); + internal_hashtables = NULL; + } + } +} + /* * Local variables: * tab-width: 4 Index: php-src/Zend/zend_hash.h === RCS file: /repository/ZendEngine2/zend_hash.h,v retrieving revision 1.75 diff -u -r1.75 zend_hash.h --- php-src/Zend/zend_hash.h25 Sep 2003 15:38:35 - 1.75 +++ php-src/Zend/zend_hash.h26 Oct 2003 16:57:40 - @@ -350,6 +350,14 @@ return zend_hash_exists(ht, arKey, nKeyLength); } +#define ZEND_INIT_INTERNAL_SYMTABLE(ht) \ +ZEND_INIT_SYMTABLE(ht); \ +zend_gc_add_internal_hashtable(ht TSRMLS_CC); + +int zend_internal_nOfHashTables(); +void zend_gc_add_internal_hashtable(HashTable *ht TSRMLS_DC); +void zend_gc_destroy_internal_hashtables(); + #endif /* ZEND_HASH_H */ /* -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] header() behaviour
Apologies if this is the wrong list. I've just been running into some wierd issues regarding the header() function, which I'm not 100% sure if it's desired behaviour or not. Basically, we have a few variables such as: $var = "foo=1&bar=2"; Now this variable gets used in 2 cases. The first is as a direct link in an . The second is as an automatic redirect using header ("Location: blah"); This works great, but in an order to make this page fully html/xhtml compliant, we've been changing $var so that it's: $var = "foo=1&bar=2"; Now, for the first case - this works absolutly fine. For the second case however, header passes the full variable without resolving & to &. I can't figure out if this is desired or not, if it's not, I'll happily draft up a patch to alter the behaviour - I just want to make sure before I do. Cheers, -- Gareth Ardron -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] internal hashtables [patch included]
> Can you please not send uuencoded stuff but just attach the files as > plain text? Sorry Derick, I didn't mean to. The patch is now included as plain text. Cristiano Duarte -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] internal hashtables [patch included]
> Can you please not send uuencoded stuff but just attach the files as > plain text? Sorry Derick, I didn't mean to. The patch is now included as plain text. Cristiano Duarte -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH][ZE2] zend_highlight.c change
In your diff, you have this line: + zend_printf("\n", last_color); There's a semicolon (;) in the tag (marked in red, if available). If that was meant to be part of the style attribute (like style=\"color: %s;\">), then it is in the wrong place. And also, if that is the place it's supposed to be, then you missed one on the +zend_printf("", last_color); line. If I'm wrong, forgive me. Sincerely, Gordon Hemsley
[PHP-DEV] [PATCH][ZE2] zend_highlight.c change
Attached is a patch to change the behavior of source highlighting functions to use instead of . This patch also introduces \n and \t when the parser encounters one (this change is mainly for readability). The reasoning is: the tag is depreciated[1], and \n and \t should be preserved, and not just translated into and 's (respectively). [1]: http://www.w3.org/TR/html4/present/graphics.html#edef-FONT Please CC me on replies. -- Regards, -Lisa --- cvs/ZendEngine2/zend_highlight.c 2003-08-11 01:24:41.0 -0400 +++ cvs-diff/ZendEngine2/zend_highlight.c 2003-10-28 14:05:59.0 -0500 @@ -30,7 +30,7 @@ { switch (c) { case '\n': - ZEND_PUTS(""); + ZEND_PUTS("\n"); break; case '<': ZEND_PUTS("<"); @@ -45,7 +45,7 @@ ZEND_PUTS(" "); break; case '\t': - ZEND_PUTS(""); + ZEND_PUTS("\t"); break; default: ZEND_PUTC(c); @@ -104,8 +104,8 @@ char *next_color; int in_string=0; - zend_printf(""); - zend_printf("\n", last_color); + zend_printf("\n"); + zend_printf("\n", last_color); /* highlight stuff coming back from zendlex() */ token.type = 0; while ((token_type=lex_scan(&token TSRMLS_CC))) { @@ -151,11 +151,11 @@ if (last_color != next_color) { if (last_color != syntax_highlighter_ini->highlight_html) { -zend_printf(""); +zend_printf(""); } last_color = next_color; if (last_color != syntax_highlighter_ini->highlight_html) { -zend_printf("", last_color); +zend_printf("", last_color); } } switch (token_type) { @@ -192,10 +192,10 @@ token.type = 0; } if (last_color != syntax_highlighter_ini->highlight_html) { - zend_printf("\n"); + zend_printf("\n"); } - zend_printf("\n"); - zend_printf(""); + zend_printf("\n"); + zend_printf("\n"); } @@ -264,4 +264,3 @@ * indent-tabs-mode: t * End: */ - -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Adding parameter to ocisavelob() && $lob->save() and additional function to OCI8 extension
If you're interrested in writing the patch yourself (and this sounds like a rather minor one), your best bet is to just write it and submit it for review (Note: It wouldn't make it into PHP4 as that branch is frozen and accepting bugfixes only, no new features, but PHP5 has room). If you don't feel up to writing it yourself, the best place to request features is http://bugs.php.net and file it under "Feature Request". There, someone can take "Assignment" of it and complete the changes in CVS. As to documentation, you can checkout the PHP Manual sources (CVS module: phpdoc) or just browse them via the web http://cvs.php.net/cvs.php/phpdoc/ to get a feel for how they're laid out. Then, write up new documentation for the missing pages and submit them to [EMAIL PROTECTED] -Sara "Antony Dovgal" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, all > > I want to propose to add an additional parameter to ocisavelob() && $lob->save();, which will allow to tell how much of LOB to read from Oracle. > As I understand, this will not break BC, if this parameter will be optional and ocisavelob() will continue to read all LOB's content by default. > > And this will require a wrapper for OCILobGetLength to make possible to get LOB's length (ocilobgetlength() imo will be the best name for it). > I can try to write a patch for this. > > Any objections? > > P.S. there are 18 functions in oci8, which are not documented for rather long time. does anybody care about it? > > --- > WBR, > Antony Dovgal aka tony2001 > [EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Adding parameter to ocisavelob() && $lob->save() and additional function to OCI8 extension
Hi, all I want to propose to add an additional parameter to ocisavelob() && $lob->save();, which will allow to tell how much of LOB to read from Oracle. As I understand, this will not break BC, if this parameter will be optional and ocisavelob() will continue to read all LOB's content by default. And this will require a wrapper for OCILobGetLength to make possible to get LOB's length (ocilobgetlength() imo will be the best name for it). I can try to write a patch for this. Any objections? P.S. there are 18 functions in oci8, which are not documented for rather long time. does anybody care about it? --- WBR, Antony Dovgal aka tony2001 [EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] internal hashtables [patch included]
On Mon, 27 Oct 2003, Cristiano Duarte wrote: > Oops, I figure out that the patch was incorrect, since the function call > should be "zend_hash_destroy" instead of "zend_hash_clean". Sorry. :-p > New patch included. > Now the memory leaks are gone forever ! Can you please not send uuencoded stuff but just attach the files as plain text? Derick > begin 666 ze2_internal_symtables.patch > M/R!P:' MF5N > M9%]A;&QO8RYC"CT]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T] > M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T*4D-3(&9I;&4Z("]R > M97!O M;F<@ M8PHM+2T@<&AP+7-R8R]:96YD+WIE;F1?86QL;V,N8PDQ-R!/8W0@,C P,R P > M,CHR.3HP-B M,# P, DQ+C$R.0HK*RL@<&AP+7-R8R]:96YD+WIE;F1?86QL > M;V,N8PDR-B!/8W0@,C P,R Q-CHU-SHS.2 M,# P, I 0" M-#<[EMAIL PROTECTED] > M-RPQ,"! 0 H@"7IE;F1?=6EN="!G M9&EF"B **PEI9B H>F5N9%]I;G1E M*2!["BL)"7IE;F1?9V-?9&5S=')O>5]I;G1E M"BL)?0HK"B C:[EMAIL PROTECTED]&5F:6YE9"A:14Y$7TU-*2 F)B A6D5.1%]$14)51PH@ > M"6EF("AC;&5A;E]C86-H92D@>PH@"0EZ96YD7VUM7W-H=71D;W=N*"9!1RAM > M;5]H96%P*2D["DEN9&5X.B!P:' MF5N9%]H87-H+F,*/3T] > M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T] > M/3T]/3T]/3T]/3T]/3T]/3T]/0I20U,@[EMAIL PROTECTED])E<&]S:71O M9$5N9VEN93(O>F5N9%]H87-H+F,[EMAIL PROTECTED]:65V:6YG(')E=FES:6]N(#$N > M,3$S"[EMAIL PROTECTED]@+7(Q+C$Q,R!Z96YD7VAA<[EMAIL PROTECTED]@<&AP+7-R8R]: > M96YD+WIE;F1?:&%S:"YC"3(Y($%U9R R,# S(# W.C,T.C,W("TP,# P"3$N > M,3$S"BLK*R!P:' MF5N9%]H87-H+F,),[EMAIL PROTECTED](#(P,#,@ > M,38Z-3 M9&EF"B **W-T M8FQE("HJ;&ES=#L**PEI;G0@;D]F2&%S:%1A8FQE M7VEN=&5R;F%L7VAA M54Q,.PHK"BMI;G0@>F5N9%]I;G1EPHK > M"7)E='5R;B H:6YT97)N86Q?:&%S:'1A8FQE M;G1E M('IE;F1?9V-?861D7VEN=&5R;F%L7VAA M(%134DU,4U]$0RD@>PHK"4AA M86Q?:&%S:'1A8FQE M97,@/2!M86QL;V,H M M,#L**PD):6YT97)N86Q?:&%S:'1A8FQE M"6EN=&5R;F%L7VAA M7VAAF5O9BA(87-H5&%B;&4J*2 J("AI;G1E > M M(&EN=&5R;F%L7VAA M7VAA M*&EN=&5R;F%L7VAA M;VED('IE;F1?9V-?9&5S=')O>5]I;G1EPHK > M"4AA M/2!.54Q,*2!["BL)"7!T M"BL)"6EF("AP='(@([EMAIL PROTECTED],3"D@>PHK"0D):6YT(&D["BL)"0EF;W(@*&D@ > M/2 P.R!I(#P@:6YT97)N86Q?:&%S:'1A8FQE M*RMI*2!["BL)"0D)>F5N9%]H87-H7V1E M='(["BL)"0E]"BL)"0EF M.PHK"0D):6YT97)N86Q?:&%S:'1A8FQE M M8FQE M86)L97,Z"B @*B!T86(M=VED=&@Z([EMAIL PROTECTED]('!H<"US M96YD7VAA<[EMAIL PROTECTED]: H]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T] > M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]"E)#4R!F:6QE.B O > M2]:96YD16YG:6YE,B]Z96YD7VAA<[EMAIL PROTECTED]:"QV"G)E=')I979I > M;F<@ M+2T@<&AP+7-R8R]:96YD+WIE;F1?:&%S:"YH"3(U(%-E<" R,# S(#$U.C,X > M.C,U("TP,# P"3$N-S4**RLK('!H<"US M-B!/8W0@,C P,R Q-CHU-SHT," M,# P, I 0" M,[EMAIL PROTECTED],U,"PQ-"! > M0 H@"7)E='5R;B!Z96YD7VAA2P@;DME>4QE > M;F=T:"D["B!]"B **R-D969I;[EMAIL PROTECTED])3DE47TE.5$523D%,7U-9351! > M0DQ%*&AT*2!<"BL@(" @(" @(%I%3D1?24Y)5%]364U404),12AH="D[(%P* > M*R @(" @(" @>F5N9%]G8U]A9&1?:6YT97)N86Q?:&%S:'1A8FQE*&AT(%13 > M4DU,4U]#0RD["BL**VEN="!Z96YD7VEN=&5R;F%L7VY/9DAA M*3L**W9O:60@>F5N9%]G8U]A9&1?:6YT97)N86Q?:&%S:'1A8FQE*$AA M86)L92 J:'[EMAIL PROTECTED]:60@>F5N9%]G8U]D97-T M=&5R;F%L7VAA 02$%32%](("HO"B *("\J"@`` > ` > end > > -- "Interpreting what the GPL actually means is a job best left to those that read the future by examining animal entrails." - Derick Rethans http://derickrethans.nl/ International PHP Magazine http://php-mag.net/ - -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php