[PHP-DEV] Re: Proposal for a new array function

2016-02-11 Thread Christian Wenz
On Mon, Feb 8, 2016 at 09:32 AM, Matthew Setter wrote: The approach I took was this: return array_keys($arr) !== range(0, count($arr) - 1); FWIW, this might not work for arrays with missing indices like [0 => 'a', 2 => 'b'] I personally would appreciate a function like you proposed. --Chr

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread Yasuo Ohgaki
Hi Stas, On Thu, Feb 11, 2016 at 4:08 PM, Stanislav Malyshev wrote: >> RFC must maintain consistency across existing features/specifications, > > There's a lot of things people call "consistency", apparently. I don't > see inventing new syntax for doing concatenation to have anything to do > with

[PHP-DEV] Re: Fw: new message

2016-02-11 Thread Christoph Becker
On 11.02.2016 at 03:19, Andrea Faulds wrote: > Why isn't "Sofie Vanderplaetsen" banned from the list yet? It's repeated > spam. I've just made a respective PR: . -- Christoph M. Becker -- PHP Internals - PHP Runtime Development Mailing List To unsubscri

Re: [PHP-DEV] Re: Proposal for a new array function

2016-02-11 Thread Rowan Collins
Christian Wenz wrote on 11/02/2016 09:17: On Mon, Feb 8, 2016 at 09:32 AM, Matthew Setter wrote: The approach I took was this: return array_keys($arr) !== range(0, count($arr) - 1); FWIW, this might not work for arrays with missing indices like [0 => 'a', 2 => 'b'] I personally would appr

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread Christoph Becker
On 11.02.2016 at 12:12, Yasuo Ohgaki wrote: > Anyway, all of us know that main source of complaints about PHP is lack > of consistency. Inconsistent APIs across modules are acceptable. It's > modules after all. However, basic language constructs like [] and {} are > better to have predictable/con

[PHP-DEV] BAD Benchmark Results for PHP Master 2016-02-11

2016-02-11 Thread lp_benchmark_robot
Results for project PHP master, build date 2016-02-11 06:28:06+02:00 commit: c6f2d61 previous commit:1c3edc3 revision date: 2016-02-10 19:04:33+01:00 environment:Haswell-EP cpu:Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread Rowan Collins
Christoph Becker wrote on 11/02/2016 12:16: Appending to an array always adds a single element only, consider $a = [1,2,3]; $a[] = [4,5]; The suggested syntax for strings would concatenate an arbitrary amount of elements (characters) to a string. IMHO, this would not be consistent, but r

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread François Laupretre
Le 11/02/2016 13:16, Christoph Becker a écrit : Appending to an array always adds a single element only, consider $a = [1,2,3]; $a[] = [4,5]; The suggested syntax for strings would concatenate an arbitrary amount of elements (characters) to a string. IMHO, this would not be consistent,

Re: [PHP-DEV] [VOTE] Contributor Guidelines, and Updates to Code of Conduct progress

2016-02-11 Thread Rowan Collins
Sammy Kaye Powers wrote on 10/02/2016 23:01: Thanks so much for taking this up Derick! :) The mission points could be reworked a bit. * Make everybody happier, especially those responsible for developing PHP itself. This has a slight insinuation that non-internals/new people are annoying to

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread Nikita Popov
On Thu, Feb 11, 2016 at 1:46 PM, Rowan Collins wrote: > Christoph Becker wrote on 11/02/2016 12:16: > >> Appending to an array always adds a single element only, consider >> >>$a = [1,2,3]; >>$a[] = [4,5]; >> >> The suggested syntax for strings would concatenate an arbitrary amount >> of

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread François Laupretre
Le 11/02/2016 13:46, Rowan Collins a écrit : Christoph Becker wrote on 11/02/2016 12:16: Appending to an array always adds a single element only, consider $a = [1,2,3]; $a[] = [4,5]; The suggested syntax for strings would concatenate an arbitrary amount of elements (characters) to a stri

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread François Laupretre
String offsets are full of oddities : $str = "abc"; $str{0} = ''; var_dump($str); // -> string(3) "bc" (read as "\0bc") Assigning an empty string to a string offset inserts a null byte because the string length is not checked in zend_assign_to_string_offset(). I see this as a bug. IMO, this c

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread Rowan Collins
Nikita Popov wrote on 11/02/2016 13:14: The issue here is not an inherent problem with string offsets, it's simply yet another artifact of PHP's overly lenient nature. If I create an IntArray class that implements ArrayAccess, I don't think you would be much surprised if doing $intArray[$i] = "

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread Andrea Faulds
Hi François, François Laupretre wrote: String offsets are full of oddities : $str = "abc"; $str{0} = ''; var_dump($str); // -> string(3) "bc" (read as "\0bc") Assigning an empty string to a string offset inserts a null byte because the string length is not checked in zend_assign_to_string_offs

Re: [PHP-DEV] [VOTE] Contributor Guidelines, and Updates to Code of Conduct progress

2016-02-11 Thread Paul M. Jones
Hi Derick, > On Feb 9, 2016, at 06:33, Derick Rethans wrote: > > Hello! > > Things have quieted down around the Code of Conduct and Contributor > Guidelines process For my part, at least, things are in "hibernation" until the wiki is updated with the new draft. Meanwhile: > - I had a call

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread Stanislav Malyshev
Hi! > Anyway, all of us know that main source of complaints about PHP is lack > of consistency. Inconsistent APIs across modules are acceptable. It's > modules after all. However, basic language constructs like [] and {} are > better to have predictable/consistent behaviors. i.e. how it works, r

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread Stanislav Malyshev
Hi! > Just having a different syntax, writing $foo{0} = 'zzz' instead of $foo[0] > = 'zzz' does not make the implicit truncation behavior any more obvious or > reasonable. If we want to actually make it less confusing, what we should It makes it clear the operation you are dealing with is not a

Re: [PHP-DEV] [VOTE] Contributor Guidelines, and Updates to Code of Conduct progress

2016-02-11 Thread Rowan Collins
Paul M. Jones wrote on 11/02/2016 17:16: Finally, these are Guidelines, but for whom? Is their violation actionable? If so, by whom, and in what circumstances? If not, then the Guidelines should say so. My understanding (admittedly I've only skim-read the text) was that this document was adv

Re: [PHP-DEV] [RFC] Generalize support of negative string offsets

2016-02-11 Thread François Laupretre
Le 11/02/2016 17:25, Andrea Faulds a écrit : Hi François, François Laupretre wrote: String offsets are full of oddities : $str = "abc"; $str{0} = ''; var_dump($str); // -> string(3) "bc" (read as "\0bc") Assigning an empty string to a string offset inserts a null byte because the string lengt