[PHP-DEV] Proposal: Rename image functions

2017-11-04 Thread Andreas Treichel
For a better readability of the gd functions I would like to rename them so that they contain underscores to separate the words. The only exception is image2wbmp which is renamed to image_to_wbmp. The order of the parameters of all functions whould be unchanged. Due to the unchanged parameters

[PHP-DEV] Re: [RFC] Match expression

2017-09-09 Thread Andreas Treichel
Hi, Something like: function match($x) { switch(true) { case $x === 1: return 'Tiny'; case is_numeric($x) && $x <= 10: return 'Small'; case is_numeric($x) && $x <= 20: return 'Medium'; case is_numeric($x) && $x <= 30:

Re: [PHP-DEV] Consider only ignoring newlines for final ?> in a file

2017-09-07 Thread Andreas Treichel
I always assumed that this is the reason why we do this in the first place. I think the main reason was that old versions of ie go into quirksmode if the doctype is not in the first line of the output e.g.: -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http

[PHP-DEV] Slow DateTimeZone::getTransitions with no argument

2017-08-15 Thread Andreas Treichel
Hi, Is the first entry in the return value of http://php.net/manual/en/datetimezone.gettransitions.php with the timestamp PHP_INT_MIN / ZEND_LONG_MIN intended? The difference with no arguments is over 100 times slower on 64 bit systems: DateTimeZone::getTransitions() Duration: 0.075577 Date

Re: [PHP-DEV] [RFC][DISCUSSION] Allow default value in list() syntax

2017-08-11 Thread Andreas Treichel
You can merge the result with default values like this: [$foo, $bar, $foobar] = explode(':', 'foo:bar') + [23, 42, 1337]; var_dump($foo, $bar, $foobar); -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Don't add simple objects to GC's roots

2017-07-30 Thread Andreas Treichel
Hi, So I propose to make the gc_disable function accept one zval reference as parameter. And if gc_disable get that zval, gc_disable just drop the zval’s GC_COLLECTABLE flag, which will hint the PHP gc not to trace that zval. i dont know if this is a good idea or not. But for the "s" in solid,

Re: [PHP-DEV] http_cookie_set and http_cookie_remove

2017-07-24 Thread Andreas Treichel
Hi Andrey, 1. The wording here implies that these are the *only* attributes allowed. In the interest of forward-compatibility, I'd allow arbitrary attributes as well. I just try to implement something like this, to allow arbitrary attributes. Is this what you prefer? http_cookie_set('foobar

Re: [PHP-DEV] http_cookie_set and http_cookie_remove

2017-07-23 Thread Andreas Treichel
Hello Andrey, That's what I was afraid of, and what I suggested be changed. If we had a similar, array-of-attributes API that did NOT ignore or trigger warnings for unknown attributes, everybody using PHP would've been able to use SameSite already. I think it is necessary to trigger a notice

Re: [PHP-DEV] http_cookie_set and http_cookie_remove

2017-07-23 Thread Andreas Treichel
Hi Michał, As an average developer, I see providing new functions with http_ prefix more meaningful and their API more simple because of fewer parameters I need to pass. Although however, I see the naming convention you've used is rarely used. Looking in the docs, there are few other HTTP sap

[PHP-DEV] Request for karma

2017-07-22 Thread Andreas Treichel
Hi, I registered my wiki account "Blar" and need some karma for my first RFC for new cookie functions. I already posted some infos about "http_cookie_set and http_cookie_remove" on the mailinglist. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.n

[PHP-DEV] Re: Minimum MySQL version

2017-07-18 Thread Andreas Treichel
On 18.7.2017 21:37, Nikita Popov wrote: What is the minimum MySQL version we support? can I drop checks for MySQL 3.x and 4.x? The "oldoldstable" Debian Wheezy from 2013 supports MySQL 5.5. The unsupported Debian Lenny has MySQL 5.0 since 2009. In my opinion the next release of PHP no longer

Re: [PHP-DEV] http_cookie_set and http_cookie_remove

2017-07-18 Thread Andreas Treichel
Hello Andrey, $options are equal to the optional parameters of setcookie and setrawcookie. $options may contain: expires: int path: string domain: string secure: bool httponly: bool 1. The wording here implies that these are the *only* attributes allowed. In the interest of forward-compatibi

[PHP-DEV] http_cookie_set and http_cookie_remove

2017-07-17 Thread Andreas Treichel
Hi, i want some feedback, about the following idea before i write a rfc. Problem: The functions setcookie and setrawcookie has many parameters. Most of them are optional and extensions (e.g. same-site) make it even more messy. The functions setcookie and setrawcookie has 8 parameters. bool s

Re: [PHP-DEV] Allow else after loop structures for,foreach and while?

2017-07-15 Thread Andreas Treichel
Hi Michael, Allow else blocks to follow iteration blocks. The else block is executed if no iteration occurs for any reason. I also thought it would been a good idea, but most of the time i need a wrapper in the output like this: if($items) { echo ''; foreach($items as $it

Re: [PHP-DEV] array coalesce operator concept

2017-07-12 Thread Andreas Treichel
> PHP already exhibits the skipping behaviour (it only emits a warning > for the wrong type used in `foreach`, skips the loop, and then > continues with remaining code). Yes, a warning is not an error. If someone dont care about warnings from error prone code, set the error_reporting accordingly

Re: [PHP-DEV] Re: [RFC] LDAP EXOP

2017-07-04 Thread Andreas Treichel
Hello, One thing though that I thought about: Chapter 4 of RFC 3062 explicitly > states that this function should only be available with confidentially > support like TLS. So perhaps we should check whether the data will be > transfered via a secure connection and - if not - raise an error? H

Re: [PHP-DEV] Re: [RFC] LDAP EXOP

2017-07-03 Thread Andreas Treichel
Hey Côme, hey Andreas. > string|FALSE ldap_exop_whoami(resource $link) - The returned string is > the DN of the currently bound user. In my opinion the code is really ease to read with exceptions. try { $user = ldap_exop_whoami($link); } catch(Throwable $e) { } string|FALSE ldap_exop_pass

[PHP-DEV] Re: [RFC] [Discussion] Class Naming

2017-07-03 Thread Andreas Treichel
With any exception from PascalCase you cannot e.g. generate class names from strings without a explicit mapping table: documentElement->tagName; $className = ucfirst($tagName) . 'Parser'; if (!class_exists($className)) { throw new RuntimeException('Parser not found for '.$tagName

[PHP-DEV] Re: [RFC] LDAP EXOP

2017-07-03 Thread Andreas Treichel
Hello, please change the signature form bool ldap_exop_whoami(resource $link, string &$result) to string ldap_whoami(resource $link); i dont see the benefit to return a single value with a reference. Without a reference the function can used as an argument: doSomethingWithTheUserName(ldap_wh