Re: [PHP-DEV] Working with arrays.
I did it like so: bitbucket.org/winapiforphp/system/src/93583820bbc1/winsystem_registry.c#cl-298 It's a little messy. On Fri, Dec 31, 2010 at 1:48 PM, Richard Quadling rquadl...@gmail.com wrote: Hi. What macros exist regarding processing arrays in PHP (core not userland)? I want to pass ... array('value1', 'value2', 'value3') to a function and in the function have it converted to 'value1\0value2\0value3\0\0'. Conventionally, I'd need to iterate the array to get the lengths of all the elements, add the number of elements to this value and then 1 more for the trailing \0. Unless there are some macros to allow to do this sort of thing more easily. Regards, Richard Quadling. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Mark Skilbeck. http://blog.mahcuz.com - webmaster http://bytes.com - PHP Forum Moderator -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] rename T_PAAMAYIM_NEKUDOTAYIM to T_DOUBLE_COLON
On Sat, 30 Oct 2010 12:44:41 -0500 Jack Timmons codeac...@codeacula.com wrote: Also, as one who also answers other's questions (although not IRC, because its my experience most people asking/*answering* questions on there are dbags), FTFY. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: deprecation status of $str{42} versus $str[42], revisited
On 22/09/10 22:34, Philip Olson wrote: Greetings geeks, This topic still lacks a defined conclusion. There are several rumors that something was decided, but I can't confirm this without archived proof. Here's the code: $str = I am an array of characters, but still a string.; echo $str[3]; // Documented as correct since 2006 echo $str{3}; // Documented as deprecated since 2006, but still no E_DEPRECATED error We discussed this uninteresting topic back in 2008 here, which includes the timeline: - http://php.markmail.org/thread/nm7n57ns23mwoshw There was no conclusion, and the thread went off topic. So because code speaks louder than words, the following will happen if this does not receive an alternative conclusion here: - Both will be considered fine, where neither is deprecated. Both will be documented as proper. One opinion is it should remain deprecated but without an E_DEPRECATED error, but I'm unsure how that makes sense. To me that says it's not deprecated, but rather, is discouraged (but still for unknown reasons). Anyway, thoughts? Also, Andi mentioned[1] the possibility of optimizing {} for string use (the original intent) in which case keeping {} would be wise. [1] http://markmail.org/message/qisqdheeyoccfydh [2] Related bug: http://bugs.php.net/52254 Regards, Philip You're right - it doesn't make sense. My vote goes to leave it as-is. -- Mark Skilbeck mahcuz.com | gtk.php.net | pecl.php.net/cairo | docs.php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: deprecation status of $str{42} versus $str[42], revisited
On 22/09/10 22:34, Philip Olson wrote: Greetings geeks, This topic still lacks a defined conclusion. There are several rumors that something was decided, but I can't confirm this without archived proof. Here's the code: $str = I am an array of characters, but still a string.; echo $str[3]; // Documented as correct since 2006 echo $str{3}; // Documented as deprecated since 2006, but still no E_DEPRECATED error We discussed this uninteresting topic back in 2008 here, which includes the timeline: - http://php.markmail.org/thread/nm7n57ns23mwoshw There was no conclusion, and the thread went off topic. So because code speaks louder than words, the following will happen if this does not receive an alternative conclusion here: - Both will be considered fine, where neither is deprecated. Both will be documented as proper. One opinion is it should remain deprecated but without an E_DEPRECATED error, but I'm unsure how that makes sense. To me that says it's not deprecated, but rather, is discouraged (but still for unknown reasons). Anyway, thoughts? Also, Andi mentioned[1] the possibility of optimizing {} for string use (the original intent) in which case keeping {} would be wise. [1] http://markmail.org/message/qisqdheeyoccfydh [2] Related bug: http://bugs.php.net/52254 Regards, Philip You're right - it doesn't make sense. My vote goes to leave it as-is with no deprecation, or having it deprecated and actually emitting the E_DEPRECATED notice. -- Mark Skilbeck mahcuz.com | gtk.php.net | pecl.php.net/cairo | docs.php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: SVN Account Request: mryaggi
On 01/06/10 14:59, Guillaume F wrote: Fix bugs i'm fed up to cope with while developping in PHP. Mr. Miyagi?! Give this man an SVN account *right now*!! -- Mark Skilbeck mahcuz.com | gtk.php.net | pecl.php.net/cairo | docs.php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: SVN Account Request: mryaggi
On 01/06/10 14:59, Guillaume F wrote: Fix bugs i'm fed up to cope with while developping in PHP. Mr. Miyagi?! Give this man an SVN account *right now*!! -- Mark Skilbeck mahcuz.com | gtk.php.net | pecl.php.net/cairo | docs.php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] ereg deprecation?
On 31/05/10 18:09, Felipe Pena wrote: Hi, 2010/4/28 Michael Macleanmich...@no-surprises.co.uk Hi, I think I asked this before on IRC, but I've forgotten the answer. I was just remembering that the ereg extension was due to be deprecated in PHP6 - does this still apply to trunk? I think make no sense to keep it deprecated. Here's a patch for undeprecate ext/ereg in 5_3 and trunk: http://felipe.ath.cx/diff/undeprecate-ereg.diff Any objection? If no, I'll commit it in soon. Why does it make no sense? It was clearly deprecated for a reason. -- Mark Skilbeck mahcuz.com | gtk.php.net | pecl.php.net/cairo | docs.php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Autoboxing in PHP
What exploits are there for __toString()? Just wondering. On 05/05/2010 07:50, Dmitry Stogov wrote: Hi Moriyoshi, I took just a quick look through the patch, but for me it looks like a bad idea. Introducing new magic function may bring a lot of troubles and open a new door for exploit writer (we already have problems with __toString() method). Also I afraid, this magic method will make php slower even if scripts don't use this future (at least the patch disables code specialization for ZEND_INIT_METHOD_CALL) and make some future type propagation optimizations non-applicable. At last the patch introduces 18 new grammar conflicts and I think it's not acceptable. Thanks. Dmitry. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [PHP-CVS] svn: /php/php-src/trunk/win32/build/ config.w32
On 29/04/2010 09:45, Hannes Magnusson wrote: On Thu, Apr 29, 2010 at 10:13, Pierre Joyepaj...@php.net wrote: pajoye Thu, 29 Apr 2010 08:13:15 + Revision: http://svn.php.net/viewvc?view=revisionrevision=298759 Log: - Adieu VC6/7/8, merci pour les bons et loyaux services In the offchance that some people actually do build PHP on windows themselfs, I think this deserves an entry in the upgrade guide. -Hannes There are *some* of us :P -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Turkish/Azeri locale support
On 04/05/2010 13:14, Adam Harvey wrote: The options are: 1. Apply Tomas's patch to make case-insensitive lookups locale-ignorant. Pros: fixes immediate problem. Cons: breaks BC for case-insensitive function/method name lookups for high-bit characters in single-byte encodings. (Not that we've ever advertised or documented that.) 2. Make function/method names case-sensitive, per Stan's e-mail. Pros: fixes problem; brings PHP into line with most other languages; extra consistency with variables; possible performance improvement. Cons: BC break from current documented behaviour. 3. Do nothing. Pros: no BC breaks of any kind. Cons: continues to annoy Turkish and Azeri developers and those developing for those locales. If you'd care to reply with a vote for option 1, 2 or 3, I'll tally up the votes in a week or so. And yes, I am volunteering to deal with this should option 1 or 2 be picked. Adam Not that my input matters, but I vote for #2. Mark Skilbeck. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: A critique of PHP 6
On 20/04/2010 15:39, Adi Nita wrote: Hi everyone, [...] Thank you for your time, Adrian Nita The PHP-way is to NEVER BREAK BC! -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] No core file being created
I'm trying to debug a segfault that's occuring in an extension I'm developing (phpgksu - PHP wrapper for libgksu2). On the PHP site it says that if I have PHP configured with --enable-debug (which I do) then whenever PHP crashes a core file should be created in the same directory the file is executing. However, I do not see one. I've even run the command as sudo ($ sudo php /file.php) to make sure PHP has the permissions to write the file. Any ideas? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] No core file being created
Scott MacVicar wrote: On 10 Nov 2009, at 13:55, Mark Skilbeck wrote: I'm trying to debug a segfault that's occuring in an extension I'm developing (phpgksu - PHP wrapper for libgksu2). On the PHP site it says that if I have PHP configured with --enable-debug (which I do) then whenever PHP crashes a core file should be created in the same directory the file is executing. However, I do not see one. I've even run the command as sudo ($ sudo php /file.php) to make sure PHP has the permissions to write the file. Any ideas? ulimit -c unlimited So you can enable core files, the debug mode in PHP just stops optimizations and stripping of symbols producing a more useful core file. Scott Antony Dovgal wrote: On 10.11.2009 16:55, Mark Skilbeck wrote: I'm trying to debug a segfault that's occuring in an extension I'm developing (phpgksu - PHP wrapper for libgksu2). On the PHP site it says that if I have PHP configured with --enable-debug (which I do) then whenever PHP crashes a core file should be created in the same directory the file is executing. However, I do not see one. I've even run the command as sudo ($ sudo php /file.php) to make sure PHP has the permissions to write the file. # sudo gdb php gdb r /file.php This way you don't need any core files at all. Thanks guys :) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: alternative to the fopen() hack in autoloaders
Lukas Kahwe Smith wrote: Ahoi, I have written an RFC for a more efficient solution to get rid of the common fopen() hack inside autoloaders: if ($fp = @fopen($file, 'r', true)) { fclose($fp); include $file; } Here is the gist of the proposal: In order to solve the above issues this RFC proposes the addition of a new construct/function for now called “autoload_include” for lack of a better name that largely behaves like the “include” does today with the following differences, that when the include failed because of a missing file no warning is raised and php null is returned. Further details can be found on the wiki: http://wiki.php.net/rfc/autoload_include As stated in the RFC, I am not happy with the name autoload_include. Suggestions welcome! regards, Lukas Kahwe Smith m...@pooteeweet.org What's the problem with file_exists() ? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Extension Development on Windows
Hey, guys/gals. Do any of you know of an up-to-date resource on setting up a development area / building extensions with VS? Everything I find is a couple of years and / doesn't work. Thanks. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Seg fault when using active_symbol_table called fromuserspace function.
Mark Skilbeck wrote: Scott MacVicar wrote: On 1 Nov 2009, at 21:41, Mark Skilbeck wrote: Scott MacVicar wrote: On 1 Nov 2009, at 21:09, Mark Skilbeck markskilb...@gmail.com wrote: [snip] There is no symbol table as there are no variables. You should check if it's NULL before using zend_hash_exists. Scott Hi, Scott. I'm having trouble - I added the check to see if the symbol table i available, yet it returns false even if I have added variables within the function: [code] PHP_FUNCTION(sample_var_a_exists) { if (!EG(active_symbol_table) || !zend_hash_exists(EG(active_symbol_table), a, sizeof(a))) { RETURN_BOOL(0); } RETURN_BOOL(1); } [/code] [code] $a = ''; var_dump(sample_var_a_exists()); function x() { $a = ''; // Add a symbol to the hash table. var_dump(sample_var_a_exists()); // Shows bool(false) } x(); [/code] -- You probably want the following to build the symbol table. if (!EG(active_symbol_table)) { zend_rebuild_symbol_table(TSRMLS_C); } Scott Yes, that works. Do you know why we have to rebuild it? I'd assume that the symbol table was built automatically? Anyone? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Is an extension dev. on 5.x usable on 5.x
Lester Caine wrote: Mark Skilbeck wrote: That is, is an extension compiled on PHP5.1 usable for PHP5.2? Windows or Linux? In Linux you can normally use an older version, provided nothing else has changed. In windows you normally get a complaint that the versions are not compatible, although some of the PECL packages have had this removed to allow 5.2.6 ones to be used with later 5.2.x builds. 5.3 WILL give different problems on windows with the different distributions provided ... Ah! Thanks for the info. So it is possible to prevent the 'not built on the same PHP version' problems (i.e., turn it off)? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Seg fault when using active_symbol_table called from userspace function.
Can you explain to me why the following causes a segfault: [code] PHP_FUNCTION(sample_var_a_exists) { if (!zend_hash_exists(EG(active_symbol_table), a, sizeof(a))) { RETURN_BOOL(0); } RETURN_BOOL(1); } [/code] Note: the segfault only occurs when the sample_var_a_exists function is called from within a userspace function: [code] $a = ''; var_dump(sample_var_a_exists()); // bool(true) function x() { var_dump(sample_var_a_exists()); // segmentation fault } x(); [/code] Thanks. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Seg fault when using active_symbol_table called from userspace function.
Scott MacVicar wrote: On 1 Nov 2009, at 21:09, Mark Skilbeck markskilb...@gmail.com wrote: [snip] There is no symbol table as there are no variables. You should check if it's NULL before using zend_hash_exists. Scott Ah - of course. Thanks for that, Scott. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Seg fault when using active_symbol_table called from userspace function.
Scott MacVicar wrote: On 1 Nov 2009, at 21:09, Mark Skilbeck markskilb...@gmail.com wrote: [snip] There is no symbol table as there are no variables. You should check if it's NULL before using zend_hash_exists. Scott Hi, Scott. I'm having trouble - I added the check to see if the symbol table i available, yet it returns false even if I have added variables within the function: [code] PHP_FUNCTION(sample_var_a_exists) { if (!EG(active_symbol_table) || !zend_hash_exists(EG(active_symbol_table), a, sizeof(a))) { RETURN_BOOL(0); } RETURN_BOOL(1); } [/code] [code] $a = ''; var_dump(sample_var_a_exists()); function x() { $a = ''; // Add a symbol to the hash table. var_dump(sample_var_a_exists()); // Shows bool(false) } x(); [/code] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Seg fault when using active_symbol_table called from userspace function.
Scott MacVicar wrote: On 1 Nov 2009, at 21:41, Mark Skilbeck wrote: Scott MacVicar wrote: On 1 Nov 2009, at 21:09, Mark Skilbeck markskilb...@gmail.com wrote: [snip] There is no symbol table as there are no variables. You should check if it's NULL before using zend_hash_exists. Scott Hi, Scott. I'm having trouble - I added the check to see if the symbol table i available, yet it returns false even if I have added variables within the function: [code] PHP_FUNCTION(sample_var_a_exists) { if (!EG(active_symbol_table) || !zend_hash_exists(EG(active_symbol_table), a, sizeof(a))) { RETURN_BOOL(0); } RETURN_BOOL(1); } [/code] [code] $a = ''; var_dump(sample_var_a_exists()); function x() { $a = ''; // Add a symbol to the hash table. var_dump(sample_var_a_exists()); // Shows bool(false) } x(); [/code] -- You probably want the following to build the symbol table. if (!EG(active_symbol_table)) { zend_rebuild_symbol_table(TSRMLS_C); } Scott Yes, that works. Do you know why we have to rebuild it? I'd assume that the symbol table was built automatically? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Is an extension dev. on 5.x usable on 5.x
That is, is an extension compiled on PHP5.1 usable for PHP5.2? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Where is the EG macro defined?
I'd like to check out how the EG macro (I assume it's a macro) works. However, I cannot find it :( -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Where is the EG macro defined?
Graham Kelly wrote: Hi, You might find http://lxr.php.net to be a useful tool to help with finding definitions in the PHP code base. - Graham Kelly On Wed, Oct 28, 2009 at 5:57 PM, Mark Skilbeck markskilb...@gmail.comwrote: I'd like to check out how the EG macro (I assume it's a macro) works. However, I cannot find it :( -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php Thank you very much. I did have a look for something like this, as I was sure I'd used it before. Thanks again, Mark. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Where is the EG macro defined?
Felipe Pena wrote: Hi. 2009/10/28 Mark Skilbeck markskilb...@gmail.com I'd like to check out how the EG macro (I assume it's a macro) works. However, I cannot find it :( Take a look in Zend/zend_globals_macros.h Cheers, Felipe. It's funny that VS didn't find it when I searched the solution :S Stupid thing. Thanks, Mark. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Where is the EG macro defined?
mm w wrote: grep is your friend, something like that grep -R define EG( /usr/include/php/Zend, it's a quite common issue you crossed Best On Wed, Oct 28, 2009 at 3:03 PM, Graham Kelly sgkel...@gmail.com wrote: Hi, You might find http://lxr.php.net to be a useful tool to help with finding definitions in the PHP code base. - Graham Kelly On Wed, Oct 28, 2009 at 5:57 PM, Mark Skilbeck markskilb...@gmail.comwrote: I'd like to check out how the EG macro (I assume it's a macro) works. However, I cannot find it :( -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php Windows :( I did run a search with VS but funnily enough it returned no results. Mark. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Where is the EG macro defined?
Keisial wrote: Mark Skilbeck wrote: I'd like to check out how the EG macro (I assume it's a macro) works. However, I cannot find it :( Zend/zend_globals_macros.h EG means executor_globals. This macro provides access to the value named in the parameter. If running without multi-thread support, it's just a call to the struct, else it expands for accessing the one for the current instance (via the hidden __tsrm parameter). Cheers for the info :) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: #49346 [Bgs]: using return() with an empty argument list is causing in a parser error
mirko dot steiner at slashdevslashnull dot de wrote: ID: 49346 User updated by: mirko dot steiner at slashdevslashnull dot de Reported By: mirko dot steiner at slashdevslashnull dot de Status: Bogus Bug Type: Reproducible crash Operating System: linux, freebsd PHP Version: 5.2.10 New Comment: thank you, for your immidiatly response. yes, i know that ,,return'' is a language construct. it is documented that the parentheses are not required (1) but not that it is necessary that there have to be an argument if the parantheses are used. using ,,echo()'' for example, which is a function(!), brings the same parser error when using empty parentheses. it seems like an error in the parser where functions or ,,language constructs'' where the parantheses are optional. (1) http://de2.php.net/manual/en/function.return.php (requested Mon Aug 24 20:45:38 CEST 2009) Previous Comments: [2009-08-24 18:08:34] sjo...@php.net Thank you for your report. The behavior you report is not a bug. You call return as if it is a function. It is not, it is a language construct. The correct syntax is: return 'bar'; or return; The parenthesis are not needed. [2009-08-24 15:20:57] mirko dot steiner at slashdevslashnull dot de Description: using return() with an empty argument list is causing in a parser error. Reproduce code: --- ?php function foo($arg) { if($arg) { return('bar'); } else { return(); } } ? Expected result: no parser error :-) Actual result: -- Parse error: syntax error, unexpected ')' in /usr/local/www/develop/htdocs/test.php on line 6 echo is a language construct also, no? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php