RE: [PHP-DEV] readfile() memory usage

2012-05-01 Thread Uwe Schindler
Hi Larry, 4) So given #2 and #3, the readfile() will kill your memory, don't use it line is a persistent urban legend that belongs on Snopes as debunked. Looping on fread() for performance is a red herring. I implemented this earlier this very year to avoid memory issues (a quick

[PHP-DEV] Bug/Req:#61422#39003 enble Type Hint autoloading

2012-05-01 Thread reeze
Hi internals: danko reported this bug#61422: Lack of autoload on type hinting breaks class_alias。 now parmeter type hint DID NOT trying to autoload. I think allow it autoloading could be helpful. BUGSCommit for quick refer: - https://bugs.php.net/bug.php?id=61422 -

[PHP-DEV] Re: Bug/Req:#61422#39003 enble Type Hint autoloading

2012-05-01 Thread Laruence
On Tue, May 1, 2012 at 8:03 PM, reeze reeze@gmail.com wrote: Hi internals: danko reported this bug#61422: Lack of autoload on type hinting breaks class_alias。 now parmeter type hint DID NOT trying to autoload.  I think allow it autoloading could be helpful. BUGSCommit for quick refer:

[PHP-DEV] Re: Bug/Req:#61422#39003 enble Type Hint autoloading

2012-05-01 Thread reeze
Hi, Laruence: I mean pass a wrong class object to a function/method. if the type hinted Class didn't loaded, we could try to load it. (if it's the right class, nothing happened), eg. function func(NotFoundClass $a) {} maybe we could pass another class instance. $a = new DemoClass();

[PHP-DEV] Re: Bug/Req:#61422#39003 enble Type Hint autoloading

2012-05-01 Thread Laruence
On Tue, May 1, 2012 at 9:07 PM, reeze reeze@gmail.com wrote: Hi, Laruence:    I mean pass a wrong class object to a function/method. if the type hinted Class didn't loaded, we could try to load it. (if it's the right class, nothing happened), eg.          function func(NotFoundClass $a)

Re: [PHP-DEV] readfile() memory usage

2012-05-01 Thread Paul Reinheimer
Hi Larry, Fascinating.  I even verified the md5sum of the file I got on the other end just to be sure.  I'll hold off on the blog post then. :-)  I look forward to your test setup. The server in question is still on PHP 5.2.13 Script: ?php ini_set('memory_limit', '8M'); $name = uniqid() .

Re: [PHP-DEV] readfile() memory usage

2012-05-01 Thread Gustavo Lopes
On Tue, 01 May 2012 15:39:56 +0200, Paul Reinheimer preinhei...@gmail.com wrote: Fascinating. I even verified the md5sum of the file I got on the other end just to be sure. I'll hold off on the blog post then. :-) I look forward to your test setup. The server in question is still on

Re: [PHP-DEV] readfile() memory usage

2012-05-01 Thread Anthony Ferrara
I know it doesn't really fit this problem in general, but I figured I would point it out. Lighttpd introduced a brilliant concept by letting the server serve that file directly. Basically, instead of using readfile, you would just send a header: X-SendFile: $filename... It's available for

Re: [PHP-DEV] readfile() memory usage

2012-05-01 Thread Rasmus Lerdorf
On 05/01/2012 06:39 AM, Paul Reinheimer wrote: Hi Larry, Fascinating. I even verified the md5sum of the file I got on the other end just to be sure. I'll hold off on the blog post then. :-) I look forward to your test setup. The server in question is still on PHP 5.2.13 Script:

Re: [PHP-DEV] readfile() memory usage

2012-05-01 Thread Rasmus Lerdorf
On 05/01/2012 07:27 AM, Rasmus Lerdorf wrote: On 05/01/2012 06:39 AM, Paul Reinheimer wrote: Hi Larry, Fascinating. I even verified the md5sum of the file I got on the other end just to be sure. I'll hold off on the blog post then. :-) I look forward to your test setup. The server in

Re: [PHP-DEV] readfile() memory usage

2012-05-01 Thread Paul Reinheimer
Hi All, Unfortunately, you've ignored Uwe's e-mail... The problem is not the PHP version; the problem is that you're buffering unlimited amounts of data. Check your configuration and make sure ob_get_level() returns 0. My apologies in the delay, ob_get_level() returns 1, good catch. phpinfo()

[PHP-DEV] [VOTE] Vote change for empty() RFC

2012-05-01 Thread Nikita Popov
Hi internals! As per Pierres request I'm posting a new voting thread for my empty() RFC. During discussions on IRC it turned out that most people would prefer to allow expressions for empty(), but not for isset(), that's why the vote now has three options: * Both empty() and isset() should

Re: [PHP-DEV] [VOTE] Vote change for empty() RFC

2012-05-01 Thread Ferenc Kovacs
* None of them should accept expressions just to be clear, this means keeping the current behavior as is. -- Ferenc Kovács @Tyr43l - http://tyrael.hu

Re: [PHP-DEV] readfile() memory usage

2012-05-01 Thread Larry Garfield
On 5/1/12 10:01 AM, Paul Reinheimer wrote: Hi All, Unfortunately, you've ignored Uwe's e-mail... The problem is not the PHP version; the problem is that you're buffering unlimited amounts of data. Check your configuration and make sure ob_get_level() returns 0. My apologies in the delay,

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Ferenc Kovacs
On Mon, Apr 30, 2012 at 2:39 PM, Nikita Popov nikita@googlemail.comwrote: On Mon, Apr 30, 2012 at 9:50 AM, Patrick ALLAERT patrickalla...@php.net wrote: Hi, 2012/4/12 Nikita Popov nikita@googlemail.com: PS: I added isset() too, to address the consistency concerns mentioned on

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Etienne Kneuss
Hi, On Tue, May 1, 2012 at 18:43, Ferenc Kovacs tyr...@gmail.com wrote: albeit I'm not laruence, but I also supported the idea to keep consistency across the allowed params of empty and isset. here is my reasoning: - both isset and empty are language constructs, which many people use almost

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Patrick ALLAERT
2012/5/1 Ferenc Kovacs tyr...@gmail.com: On Mon, Apr 30, 2012 at 2:39 PM, Nikita Popov nikita@googlemail.comwrote: - both isset and empty are language constructs, which many people use almost interchangeability, changing one of them in a way that the same expression works with one of

Re: [PHP-DEV] Fixing bug #18556 (was: Complete case-sensitivity in PHP)

2012-05-01 Thread Galen Wright-Watson
On Thu, Apr 26, 2012 at 3:45 AM, C.Koy can5...@gmail.com wrote: As of 5.3.0 this bug does not exist for function names. Only classes and interfaces. Turns out, if you cause a function to be called dynamically by (e.g.) using a variable function, the bug will surface. ?php

Re: [PHP-DEV] Fixing bug #18556 (was: Complete case-sensitivity in PHP)

2012-05-01 Thread Galen Wright-Watson
On Tue, May 1, 2012 at 11:11 AM, Galen Wright-Watson ww.ga...@gmail.comwrote: [...] Instead, a second set of locale-independent, unicode-aware conversion functions (basically, iliaa's original solution, but Unicode compatible) to be used for identifiers would make name resolution independent

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Ferenc Kovacs
On Tue, May 1, 2012 at 7:24 PM, Patrick ALLAERT patrickalla...@php.netwrote: 2012/5/1 Ferenc Kovacs tyr...@gmail.com: On Mon, Apr 30, 2012 at 2:39 PM, Nikita Popov nikita@googlemail.com wrote: - both isset and empty are language constructs, which many people use almost

Re: [PHP-DEV] readfile() memory usage

2012-05-01 Thread Paul Reinheimer
Hi, It sounds like it.  In that case the memory spike is happening in the output buffer, where the file is streamed into by readfile() in 8K chunks until the output buffer explodes. :-) So, I think we're back to urban legend territory. That's good to know. Thanks, and my apologies for

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Ferenc Kovacs
So isset(UNDEFINEDCONSTANT) will be isset(UNDEFINEDCONSTANT) which will/should 1) yield a notice, which is unnexpected for isset 2) return true, which is also unexpected. I don't see much point in that. yep, and if we allow expressions then it is the expected behavior, but you are right

[PHP-DEV] Re: Bug/Req:#61422#39003 enble Type Hint autoloading

2012-05-01 Thread Danko Alexeyev
Hi everyone, On 05/01/2012 03:25 PM, Laruence wrote: if you pass a right instance of class to a function , how can that class not be loaded already? for example: function foo(Foo_Bar $a) { } how can you pass a Foo_Bar instance to function foo without Foo_Bar class

Re: [PHP-DEV] Re: Bug/Req:#61422#39003 enble Type Hint autoloading

2012-05-01 Thread Stas Malyshev
Hi! Because Foo_Bar could be *defined* under a different name, say, Foo_Blah. Then, as soon as someone needed Foo_Bar, we would use class_alias to add an alias. That is, as soon as someone tried using class_alias is a dirty hack. instanceof implies that the object is an instance of

Re: [PHP-DEV] [RFC] Allow non-variable arguments to empty() and isset()

2012-05-01 Thread Xinchen Hui
Sent from my iPhone 在 2012-5-2,3:52,Ferenc Kovacs tyr...@gmail.com 写道: So isset(UNDEFINEDCONSTANT) will be isset(UNDEFINEDCONSTANT) which will/should 1) yield a notice, which is unnexpected for isset 2) return true, which is also unexpected. I don't see much point in that. yep, and if

[PHP-DEV] how to instantiate new object

2012-05-01 Thread Yader Hernandez
Hello, I was wondering how to create a new object from a function call? By this I mean if I call foo() from a script, that should return a new instance of an object. If I call foo() again, it should be a new instance of an object as well. I haven't been able to find any good examples from the

[PHP-DEV] Re: how to instantiate new object

2012-05-01 Thread Yader Hernandez
On Tue, May 1, 2012 at 8:46 PM, Yader Hernandez yader.hernan...@gmail.comwrote: Hello, I was wondering how to create a new object from a function call? By this I mean if I call foo() from a script, that should return a new instance of an object. If I call foo() again, it should be a new

Re: [PHP-DEV] Re: how to instantiate new object

2012-05-01 Thread Laruence
On Wed, May 2, 2012 at 1:16 PM, Yader Hernandez yader.hernan...@gmail.com wrote: On Tue, May 1, 2012 at 8:46 PM, Yader Hernandez yader.hernan...@gmail.comwrote: Hello, I was wondering how to create a new object from a function call? By this I mean if I call foo() from a script, that should

Re: [PHP-DEV] Re: how to instantiate new object

2012-05-01 Thread Laruence
On Wed, May 2, 2012 at 1:27 PM, Laruence larue...@php.net wrote: On Wed, May 2, 2012 at 1:16 PM, Yader Hernandez yader.hernan...@gmail.com wrote: On Tue, May 1, 2012 at 8:46 PM, Yader Hernandez yader.hernan...@gmail.comwrote: Hello, I was wondering how to create a new object from a

Re: [PHP-DEV] Re: how to instantiate new object

2012-05-01 Thread Laruence
BTW: you should write to pecl-dev ML for such questions. thanks On Wed, May 2, 2012 at 1:28 PM, Laruence larue...@php.net wrote: On Wed, May 2, 2012 at 1:27 PM, Laruence larue...@php.net wrote: On Wed, May 2, 2012 at 1:16 PM, Yader Hernandez yader.hernan...@gmail.com wrote: On Tue, May 1,