[PHP-DEV] Getting path of currently executing file from within stream_opener handler

2007-11-17 Thread Marshall Greenblatt
Hi All, I have a stream wrapper implementation that needs to properly resolve relative paths. For example, say I have a file structure like the following: file1.php dir/file2.php dir/file3.php file4.php file1.php contains: ?php include 'dir/file2.php'; ? file2.php contains: ?php include

Re: [PHP-DEV] Getting path of currently executing file from within stream_opener handler

2007-11-17 Thread Antony Dovgal
On 17.11.2007 11:23, Marshall Greenblatt wrote: Is there a method that can be used from within the stream_opener handler function to retrieve the path of the file currently being processed? Yes, zend_get_executed_filename(). Though, I believe you actually need expand_filepath(), which does

[PHP-DEV] [PATCH] Bug #42866 str_split() returns extra char when given string size is not multiple of length

2007-11-17 Thread Claudio Cherubino
Bug Description: - str_split() returns extra characters when given string is not multiple of given length. For example if the given string size is 22 and split length is 5, then the last element of the returned array contains 5 or more than 5 chars, which is wrong. The last

[PHP-DEV] Bring back call-time pass-by-reference

2007-11-17 Thread Karoly Negyesi
Hi, Although this should be an old hat, I am surprised PHP5 has not fixed it, let's fix it in PHP6. There are things you can't without call time pass-by-reference, most of all variables arguments with references. So, please de-deprecate it. Thanks much, Karoly Negyesi -- PHP Internals - PHP

Re: [PHP-DEV] Bring back call-time pass-by-reference

2007-11-17 Thread Brian Moon
Karoly Negyesi wrote: Hi, Although this should be an old hat, I am surprised PHP5 has not fixed it, let's fix it in PHP6. There are things you can't without call time pass-by-reference, most of all variables arguments with references. So, please de-deprecate it. I am feeling froggy. I will

Re: [PHP-DEV] Bring back call-time pass-by-reference

2007-11-17 Thread Karoly Negyesi
Dear Brian, Say, you have a CMS which generally calls some kind of functions and some of them might need to modify one array the other needs to modify two arrays... Currently you need to wrap these into a arguments array otherwise func_get_args will butcher your references. Regards, NK -- PHP

[PHP-DEV] Restore output buffer in case of exceptions

2007-11-17 Thread Mehmet Yavuz Selim Soyturk
Hello, I'm sorry if that's the wrong list. I am neither a PHP nor a webscripting guy so I'm sorry if this does not make sense. I just thought that it could be useful. PHP 5 supports exception handling. When an exception occurs, PHP does stack unwinding so that it restores the state of the

Re: [PHP-DEV] Restore output buffer in case of exceptions

2007-11-17 Thread Antony Dovgal
On 18.11.2007 01:36, Mehmet Yavuz Selim Soyturk wrote: That is the idea: ?php exceptional_ob_start(); echo Begin\n; try { echo Exception\n; throw new Exception(); } catch (Exception $e) {} echo End\n; exceptional_ob_end_flush(); ? And that would be the only output:

Re: [PHP-DEV] Restore output buffer in case of exceptions

2007-11-17 Thread Alexey Zakhlestin
On 11/18/07, Antony Dovgal [EMAIL PROTECTED] wrote: On 18.11.2007 01:36, Mehmet Yavuz Selim Soyturk wrote: That is the idea: ?php exceptional_ob_start(); echo Begin\n; try { echo Exception\n; throw new Exception(); } catch (Exception $e) {} echo End\n;

Re: [PHP-DEV] Bring back call-time pass-by-reference

2007-11-17 Thread Stanislav Malyshev
Say, you have a CMS which generally calls some kind of functions and some of them might need to modify one array the other needs to modify two arrays... Currently you need to wrap these into a arguments array otherwise func_get_args will butcher your references. Can you give a short code

Re: [PHP-DEV] Restore output buffer in case of exceptions

2007-11-17 Thread Evert | Rooftop
Mehmet Yavuz Selim Soyturk wrote: Hello, I'm sorry if that's the wrong list. I am neither a PHP nor a webscripting guy so I'm sorry if this does not make sense. I just thought that it could be useful. PHP 5 supports exception handling. When an exception occurs, PHP does stack unwinding so

Re: [PHP-DEV] Restore output buffer in case of exceptions

2007-11-17 Thread Edward Z. Yang
Evert | Rooftop wrote: Generally I make sure that the parts of my code that start an output buffer are also responsible for closing the output buffer.. so something like this wouldn't be uncommon in my code.. Agreed. If you'd like to implement transaction support using PHP's exceptions, you'll

Re: [PHP-DEV] Restore output buffer in case of exceptions

2007-11-17 Thread Mehmet Yavuz Selim Soyturk
On Nov 18, 2007 1:38 AM, Evert | Rooftop [EMAIL PROTECTED] wrote: Generally I make sure that the parts of my code that start an output buffer are also responsible for closing the output buffer.. so something like this wouldn't be uncommon in my code.. ob_start(); try { do_something(); }

Re: [PHP-DEV] Bring back call-time pass-by-reference

2007-11-17 Thread Gergely Hodicska
Say, you have a CMS which generally calls some kind of functions and some of them might need to modify one array the other needs to modify two arrays... Currently you need to wrap these into a arguments array otherwise func_get_args will butcher your references. In PHP6

Re: [PHP-DEV] Bring back call-time pass-by-reference

2007-11-17 Thread Gergely Hodicska
Hi! some of them might need to modify one array the other needs to modify two arrays... But every function knows the number of its own arguments, isn't it? array otherwise func_get_args will butcher your references. This behavior has nothing to do with the call-time-pass-reference

Re: [PHP-DEV] Getting path of currently executing file from within stream_opener handler

2007-11-17 Thread Marshall Greenblatt
Hi Antony, On Nov 17, 2007 5:21 AM, Antony Dovgal [EMAIL PROTECTED] wrote: On 17.11.2007 11:23, Marshall Greenblatt wrote: Is there a method that can be used from within the stream_opener handler function to retrieve the path of the file currently being processed? Yes,

Re: [PHP-DEV] Re: Question about superglobals

2007-11-17 Thread Stanislav Malyshev
You say that superglobals were not designed to be user defined, think about it, the concept of a superglobal is present in C and C++, two of the maturest and strictest languages around. Concept of inserting assembly code is in C and C++ too. That doesn't mean it's a good idea to add it to PHP.

Re: [PHP-DEV] Re: Question about superglobals

2007-11-17 Thread Stanislav Malyshev
You have to specifically declare superglobals, just like in runkit. No difference between this and using runkit except ease of use. As you noticed, runkit is not a standard module of PHP. And for a good reason - runkit it's for doing things that you are not supposed to do with PHP, but since

Re: [PHP-DEV] Re: Question about superglobals

2007-11-17 Thread Stanislav Malyshev
I don't understand, people keep telling me this can cause problems so it's trash. Really? Functions and variables can cause problems too. Not That's the core of the misunderstanding - your superglobals proposal has much higher potential for causing problems than functions and variables in

Re: [PHP-DEV] Re: Question about superglobals

2007-11-17 Thread Stanislav Malyshev
This assumes there is never a good reason for a super global which makes me wonder why PHP has super globals at all then? What if, because I use There is a good reason, and exactly for things that PHP has as superglobals. Because these variables - system variables - are unique and

Re: [PHP-DEV] Question about constants

2007-11-17 Thread Stanislav Malyshev
If i were to implement some type of patch, could i define a php constant to indicate the patch has been applied while staying within the php naming conventions? If so, what should i prefix with? I don't think we have any standard for third-party engine functionality detection. Since you add a

Re: [PHP-DEV] Restore output buffer in case of exceptions

2007-11-17 Thread Stanislav Malyshev
That is the idea: ?php exceptional_ob_start(); echo Begin\n; try { echo Exception\n; throw new Exception(); } catch (Exception $e) {} echo End\n; exceptional_ob_end_flush(); You can do it, I think - just another bufferign inside try() and clean it on exception, then output it after

Re: [PHP-DEV] Bring back call-time pass-by-reference

2007-11-17 Thread Cristian Rodriguez
2007/11/17, Karoly Negyesi [EMAIL PROTECTED]: There are things you can't without call time pass-by-reference, huh ? are you seriuos ? care to show some proof of your statements ? -- http://www.kissofjudas.net/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] Re: Question about superglobals

2007-11-17 Thread Cristian Rodriguez
2007/11/17, Rasmus Lerdorf [EMAIL PROTECTED]: Trust me, you will grumble a lot more at that. I agree, This is usually not a problem when you are the only person that looks at a very small amount of code, but later when app gets bigger it becomes and unmanteniable mess and I dont want the