Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Yasuo Ohgaki
Hi Anthony, On Wed, Jun 24, 2015 at 12:00 PM, Yasuo Ohgaki wrote: > On Wed, Jun 24, 2015 at 10:40 AM, Anthony Ferrara > wrote: > >> > >> > IMHO, escape/unescape/encode/decode/conversion function is better to >> accept >> > any types. >> > HTML template may be separated script, but database code

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Yasuo Ohgaki
Hi Juan, On Wed, Jun 24, 2015 at 12:05 PM, Juan Basso wrote: > Did you test the performance impact on strings? Since you changed how it > works the impact can be positive and maybe worth to make the method more > broad. It's a bit slower (~3%) for 'abc' as input string. If I remove redundant t

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Juan Basso
Yasuo, Did you test the performance impact on strings? Since you changed how it works the impact can be positive and maybe worth to make the method more broad. Juan Basso On Jun 23, 2015 23:01, "Yasuo Ohgaki" wrote: > Hi Anthony, > > On Wed, Jun 24, 2015 at 10:40 AM, Anthony Ferrara > wrote: >

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Yasuo Ohgaki
Hi Anthony, On Wed, Jun 24, 2015 at 10:40 AM, Anthony Ferrara wrote: > > > > IMHO, escape/unescape/encode/decode/conversion function is better to > accept > > any types. > > HTML template may be separated script, but database code etc may not. > > > > Writing code like > > > > > declare(strict_

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Yasuo Ohgaki
Hi Xinchen, On Wed, Jun 24, 2015 at 11:42 AM, Xinchen Hui wrote: > and for the "age" usage you replied in github, I think the author of > such codes should be aware, if it's only number, then instead of > htmlespcicalchars($age), he should use echo $age directly... which is > more faster. > T

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Xinchen Hui
Hey: On Wed, Jun 24, 2015 at 10:35 AM, Yasuo Ohgaki wrote: > Hi Xinchen, > > On Wed, Jun 24, 2015 at 11:31 AM, Xinchen Hui wrote: >> >> >> >> >> On Wed, Jun 24, 2015 at 8:32 AM, Yasuo Ohgaki wrote: >> > Hi Xinchen, >> > >> > On Tue, Jun 23, 2015 at 11:33 PM, Xinchen Hui wrote: >> >> >> >> But

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Yasuo Ohgaki
Hi Xinchen, On Wed, Jun 24, 2015 at 11:31 AM, Xinchen Hui wrote: > > > > On Wed, Jun 24, 2015 at 8:32 AM, Yasuo Ohgaki wrote: > > Hi Xinchen, > > > > On Tue, Jun 23, 2015 at 11:33 PM, Xinchen Hui wrote: > >> > >> But passing an non-string to htmlspecialchars are not common used > cases.. > >>

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Xinchen Hui
Hey: On Wed, Jun 24, 2015 at 8:32 AM, Yasuo Ohgaki wrote: > Hi Xinchen, > > On Tue, Jun 23, 2015 at 11:33 PM, Xinchen Hui wrote: >> >> But passing an non-string to htmlspecialchars are not common used cases.. >> >> "optimize" not common used cases... will bring nothing to us.. > > > The reason

[PHP-DEV] Move to Fast ZPP?

2015-06-23 Thread Yasuo Ohgaki
Hi all, I'm wondering the state of Fast ZPP. https://wiki.php.net/rfc/fast_zpp Last year's Dmirty's commit message say, it should only applied to most used functions due to the state of Fast ZPP. commit 27f38798a1963de1c60aae4ef8a3675138255574 Author: Dmitry Stogov Date: Fri Jul 11 16:32:20 2

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Anthony Ferrara
Yasuo, > > IMHO, escape/unescape/encode/decode/conversion function is better to accept > any types. > HTML template may be separated script, but database code etc may not. > > Writing code like > > declare(strict_types=1); > $sql = 'SELECT * FROM '. pg_escape_identifier((string)$table). ' WHERE i

Re: [PHP-DEV] Re: Typed Arrays in Scalar Types RFC

2015-06-23 Thread Yasuo Ohgaki
Hi all, On Wed, Jun 24, 2015 at 5:20 AM, Christoph Becker wrote: > > I would like to submit an RFC for supporting typed arrays as > function/method argument and return types. Please either throw stones at me > or give me enough karma to post it. > > > > My php.net username is t

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Yasuo Ohgaki
Hi Xinchen, On Tue, Jun 23, 2015 at 11:33 PM, Xinchen Hui wrote: > But passing an non-string to htmlspecialchars are not common used cases.. > > "optimize" not common used cases... will bring nothing to us.. > The reason why I looked into this in the first place is one of my friend complained a

Re: [PHP-DEV] Re: Typed Arrays in Scalar Types RFC

2015-06-23 Thread Dan Ackroyd
Tim Bezhashvyly wrote: > Please either throw stones at me or give me enough karma to post it. Sorry, I have neither the ability to give karma, nor a convenient pile of stones. Christoph Becker wrote: > Note that there is already , which has > been declined. The

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Yasuo Ohgaki
Hi all, On Wed, Jun 24, 2015 at 6:51 AM, Yasuo Ohgaki wrote: > I got it. > > On Wed, Jun 24, 2015 at 6:41 AM, Yasuo Ohgaki wrote: > >> On Wed, Jun 24, 2015 at 12:21 AM, Anthony Ferrara >> wrote: >> >>> In addition, this breaks the contract, specifically when using scalar >>> types. Because you

[PHP-DEV] [Q] Session provider & returning FAILURE from PS_OPEN_FUNC?

2015-06-23 Thread Eric Stenson
Quick behavioral question: If an extension is implementing a Session handler, and returns FAILURE from its PS_OPEN_FUNC(), will the extension receive subsequent PS_READ_FUNC()/PS_WRITE_FUNC() calls? Also, if an extension returns FAILURE from its PS_OPEN_FUNC(), will the extension receive a PS_

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Yasuo Ohgaki
Hi Anthony, I got it. On Wed, Jun 24, 2015 at 6:41 AM, Yasuo Ohgaki wrote: > On Wed, Jun 24, 2015 at 12:21 AM, Anthony Ferrara > wrote: > >> In addition, this breaks the contract, specifically when using scalar >> types. Because you're no longer going to error when the contract is >> broken (c

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Stanislav Malyshev
Hi! > Current php_html_entities() convert int/float/etc to string, then convert > it. > int/float/etc is not required to be escaped. Optimize it by simply > converting them to string. I'm not sure this is the case that is used frequently enough to actually optimize for it in PHP code. If for part

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Yasuo Ohgaki
Hi Anthony, On Wed, Jun 24, 2015 at 12:21 AM, Anthony Ferrara wrote: > In addition, this breaks the contract, specifically when using scalar > types. Because you're no longer going to error when the contract is > broken (considering htmlspecialchars is documented as string:string). > What do yo

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Yasuo Ohgaki
Hi Xinchen, On Tue, Jun 23, 2015 at 11:33 PM, Xinchen Hui wrote: > But passing an non-string to htmlspecialchars are not common used cases.. > > "optimize" not common used cases... will bring nothing to us.. > The reason why I brought up this now is scalar type hint. Before PHP7, people didn't

[PHP-DEV] Re: Typed Arrays in Scalar Types RFC

2015-06-23 Thread Christoph Becker
Tim Bezhashvyly wrote: > I would like to submit an RFC for supporting typed arrays as function/method > argument and return types. Please either throw stones at me or give me enough > karma to post it. > > My php.net username is tim-bezhashvyly. Note that there is already

[PHP-DEV] Typed Arrays in Scalar Types RFC

2015-06-23 Thread Tim Bezhashvyly
Dear internals, I would like to submit an RFC for supporting typed arrays as function/method argument and return types. Please either throw stones at me or give me enough karma to post it. My php.net username is tim-bezhashvyly. Regards, Tim

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Anthony Ferrara
On Tue, Jun 23, 2015 at 10:33 AM, Xinchen Hui wrote: > Hey: > > On Tue, Jun 23, 2015 at 7:37 PM, Yasuo Ohgaki wrote: >> Hi all, >> >> I'm trying to optimize php_html_entities(). >> Since htmlspecialchars()/htmlentities() are sensitive function, I would >> like to ask comments before merge. >> >>

Re: [PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Xinchen Hui
Hey: On Tue, Jun 23, 2015 at 7:37 PM, Yasuo Ohgaki wrote: > Hi all, > > I'm trying to optimize php_html_entities(). > Since htmlspecialchars()/htmlentities() are sensitive function, I would > like to ask comments before merge. > > https://github.com/php/php-src/pull/1356 > > Current php_html_enti

Re: [PHP-DEV] hasType() for internal function parameters?

2015-06-23 Thread Pierre Joye
On Jun 23, 2015 1:21 PM, "Rasmus Lerdorf" wrote: > > On 06/22/2015 11:51 PM, Stanislav Malyshev wrote: > > Hi! > > > >> Is it a BC break against real code though? Fixing tests isn't a > >> big deal. What kind of real code would break by turning calls with > >> the wrong number of args from an erro

[PHP-DEV] Re: adding next-minor and next-major versions to the bugtracker

2015-06-23 Thread Maciej Sobaczewski
W dniu 2015-06-23 o 14:07, Ferenc Kovacs pisze: Hi, I would like to add two new PHP versions to the bugtracker, which can be used for target version for feature requests. Currently filling that out is mandatory, so we have a bunch of feature request with "random" target versions (usually either

[PHP-DEV] adding next-minor and next-major versions to the bugtracker

2015-06-23 Thread Ferenc Kovacs
Hi, I would like to add two new PHP versions to the bugtracker, which can be used for target version for feature requests. Currently filling that out is mandatory, so we have a bunch of feature request with "random" target versions (usually either the version used by the reporter or the latest ver

[PHP-DEV] Optimizing php_html_entities()

2015-06-23 Thread Yasuo Ohgaki
Hi all, I'm trying to optimize php_html_entities(). Since htmlspecialchars()/htmlentities() are sensitive function, I would like to ask comments before merge. https://github.com/php/php-src/pull/1356 Current php_html_entities() convert int/float/etc to string, then convert it. int/float/etc is n

Re: [PHP-DEV] hasType() for internal function parameters?

2015-06-23 Thread Dan Ackroyd
Levi Morrison wrote: > One thing I really want to work towards in the future is consistency > between user-land and internal functions. There are currently multiple > observable differences. +1, as they say. This is the goal we should be aiming for. Having differences between userland and intern

Re: [PHP-DEV] PHP-FPM: How to clear the realpath cache on deployment?

2015-06-23 Thread Alexander Lisachenko
Hello, internals! I remember the crazy code for invalidating the opcache/realpath entries from CLI. Logic was the following: tool asks for the server name with php-fpm to connect to via ssh connection, then it prepares a small PHP-file and uploads it to the temp directory on this server and then

Re: [PHP-DEV] RFC - making the Exception class abstract

2015-06-23 Thread Dan Ackroyd
Hi Kevin, Kevin Bradwick wrote: > Too many times have I seen developers throwing Exceptions when what they > really needed was something that gave it context like > InvalidArgumentException or RuntimeException. > > Yes, I agree this is something to tackle at code review (and I do) but > I feel PHP