[PHP-DEV] Re: [PHP-WEBMASTER] New wiki account

2012-05-11 Thread Alexander Moskaliov
I think the main idea of ​​this RFC: Run the code, if we had never entered
in loop.
In this case more sence to change for .. else condition to this:
If second expression  is equal FALSE before looping(but after run first
expression of course), we run else code.

By example:
for (exp1;exp2;exp3) {
exp4;
} else {
exp5;
}

must be equal
$notLooping = true;
for (exp1;exp2;exp3) {
exp4;
$notLooping = false;
}
if ($notLooping) {
exp5;
}

With regards, Alexander Moskaliov
ir...@irker.net


2012/5/10 Dmitri Ravazin rava...@gmail.com

 Hi,

 I registered account 'ravazin' on wiki.
 I'd like to write an RFC based on bugs:

 https://bugs.php.net/bug.php?id=26411
 https://bugs.php.net/bug.php?id=46240
 https://bugs.php.net/bug.php?id=61222

 I think it's time these requests got some sort of resolution :)



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

2012-05-11 Thread Simon Schick
Hi, Everyone

FYI: If you just want to check something before serving a file to the
client, you can also use something called xsendfile.

Apache: https://tn123.org/mod_xsendfile/
lighttpd: It's build in :)
nginx: http://wiki.nginx.org/XSendfile

Idea:
Do what you're doing in your php-script and add the header
X-Sendfile: $yourFile (nginx is using another header).
This header will trigger the plugin and the webserver will serve the
file instead of your php-process.

I personally use it on my webserver and it works quite fine. Debian
has a compiled package called libapache2-mod-xsendfile in version 0.9

Bye
Simon

On Fri, May 4, 2012 at 2:33 PM, Paul Reinheimer preinhei...@gmail.com wrote:

 Hi Everyone

  So, I think we're back to urban legend territory.

 I've updated the documentation for readfile() to help send more people
 down the path of checking for output buffering, and disabling that
 rather than contriving loops with fread().

 http://docs.php.net/readfile



 paul


 --
 Paul Reinheimer

 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



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

2012-05-11 Thread Sebastian Krebs
Hi,

2012/5/11 Simon Schick simonsimc...@googlemail.com

 Hi, Everyone

 FYI: If you just want to check something before serving a file to the
 client, you can also use something called xsendfile.

 Apache: https://tn123.org/mod_xsendfile/
 lighttpd: It's build in :)
 nginx: http://wiki.nginx.org/XSendfile


It's named X-Accel and build in too (as long as it's not explicitly
disabled)

http://wiki.nginx.org/Modules
http://wiki.nginx.org/X-accel





 Idea:
 Do what you're doing in your php-script and add the header
 X-Sendfile: $yourFile (nginx is using another header).
 This header will trigger the plugin and the webserver will serve the
 file instead of your php-process.

 I personally use it on my webserver and it works quite fine. Debian
 has a compiled package called libapache2-mod-xsendfile in version 0.9

 Bye
 Simon

 On Fri, May 4, 2012 at 2:33 PM, Paul Reinheimer preinhei...@gmail.com
 wrote:
 
  Hi Everyone
 
   So, I think we're back to urban legend territory.
 
  I've updated the documentation for readfile() to help send more people
  down the path of checking for output buffering, and disabling that
  rather than contriving loops with fread().
 
  http://docs.php.net/readfile
 
 
 
  paul
 
 
  --
  Paul Reinheimer
 
  --
  PHP Internals - PHP Runtime Development Mailing List
  To unsubscribe, visit: http://www.php.net/unsub.php
 

 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Re: [PHP-WEBMASTER] New wiki account

2012-05-11 Thread Nikita Popov
On Fri, May 11, 2012 at 8:33 AM, Alexander Moskaliov ir...@irker.net wrote:
 I think the main idea of this RFC: Run the code, if we had never entered
 in loop.
 In this case more sence to change for .. else condition to this:
 If second expression  is equal FALSE before looping(but after run first
 expression of course), we run else code.

 By example:
 for (exp1;exp2;exp3) {
    exp4;
 } else {
    exp5;
 }

Python already uses the for .. else syntax, but with different
semantics: In Python the else clause is only executed, if the loop
isn't left using break. See this article for more info:
http://psung.blogspot.de/2007/12/for-else-in-python.html

Thus I'm not sure that it really makes sense for us to introduce this
syntax with a completely different meaning.

Nikita

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] the problem of php with gmail

2012-05-11 Thread lijiu zhang
Hi guys:

I have a problem when I use php send email by gmail. At the beginning, it
is fine, but the errors came after sending some emails.

Warning: fwrite() [function.fwrite]: SSL operation failed with code 1.
OpenSSL Error messages: error:140D00CF:SSL routines:SSL_write:protocol is
shutdown in

Could anyone know this problem?

Regards,
LijiuZhang


[PHP-DEV] Re: [PHP-WEBMASTER] New wiki account

2012-05-11 Thread Dmitri Ravazin
On Fri, May 11, 2012 at 2:33 AM, Alexander Moskaliov ir...@irker.net wrote:

 I think the main idea of this RFC: Run the code, if we had never entered
 in loop.
 In this case more sence to change for .. else condition to this:
 If second expression  is equal FALSE before looping(but after run first
 expression of course), we run else code.

 By example:
 for (exp1;exp2;exp3) {
     exp4;
 } else {
     exp5;
 }

 must be equal
 $notLooping = true;
 for (exp1;exp2;exp3) {
     exp4;
     $notLooping = false;
 }
 if ($notLooping) {
     exp5;
 }


Yes... That's just what I had in the RFC.
Except I used the name $loop_entered, and then checked for it being
false, and you used variable $notLooping, and checked for it being
true.
That is the same thing.

Hey, I noticed you CC'ed internals, does that mean everyone on the
list is getting this?
Sorry, not entirely familiar with how these mailing lists work.


On Fri, May 11, 2012 at 6:21 AM, Nikita Popov nikita@googlemail.com wrote:
 Python already uses the for .. else syntax, but with different
 semantics: In Python the else clause is only executed, if the loop
 isn't left using break. See this article for more info:
 http://psung.blogspot.de/2007/12/for-else-in-python.html

 Thus I'm not sure that it really makes sense for us to introduce this
 syntax with a completely different meaning.

 Nikita

Python isn't always right in how it does things.
I find python for...else logic to have fewer real-life use-cases than
what is being proposed here.
I'm speaking from my experience, of course, and not saying it's true
for every project out there... But if the comments to those bugs are
any indication, it is true for most people.
You will notice that all 3 proposals (spanning almost 10 years)
advocate the non-python logic.

And even if you look at the example from your article, it does *not*
demonstrate usefulness of for...else in python.
I can write the same code without for...else and without any flag
variables by just returning from the function, instead of breaking:

def contains_even_number(l):
  Prints whether or not the list l contains an even number.
  for elt in l:
if elt % 2 == 0:
  print list contains an even number
  return
  print list does not contain an even number

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Re: [PHP-WEBMASTER] New wiki account

2012-05-11 Thread Kris Craig


 Hey, I noticed you CC'ed internals, does that mean everyone on the
 list is getting this?
 Sorry, not entirely familiar with how these mailing lists work.




Yep.  And at least for my part, I have no idea what RFC you guys are
talking about lol.  ;P

--Kris


Re: [PHP-DEV] Re: [PHP-WEBMASTER] New wiki account

2012-05-11 Thread Alexander Moskaliov
2012/5/12 Dmitri Ravazin rava...@gmail.com

 Yes... That's just what I had in the RFC.


Not at all. In RFC you use first expression in for ... else statement as
condition for else statement.

if (some_very_expensive_and_ugly_looking_calculation($array)  0) {

}


 I think it correct to use the second expression before the start of
looping, as I described in previous mail.


2012/5/12 Kris Craig kris.cr...@gmail.com

 Yep.  And at least for my part, I have no idea what RFC you guys are
 talking about lol.  ;P

Sorry, RFC link was in old thread: https://wiki.php.net/rfc/loop_else

With regards, Alexander Moskaliov
ir...@irker.net