Re: [PHP-DEV] Funny array function

2012-09-30 Thread Andrew Faulds
, and most effecient Not really. A PHP function to implement it, done without recursion, would be pretty efficient. And unless you're making tens of thousands of these operations, this is probably a case of premature optimisation. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime

Re: [PHP-DEV] mbstring, a proposition of additional functions

2012-09-24 Thread Andrew Faulds
. I would love such a library to be built into PHP. A more consistent approach to scalar operations would be great. hello, world-replace('world', 'php'); would be so much nicer than str_replace and forgetting the argument order. This is a little off-topic, though. -- Andrew Faulds http://ajf.me

Re: [PHP-DEV] POST, content-type: application/json and json_decode

2012-09-24 Thread Andrew Faulds
? Maybe a RFC would also be welcome to complete my suggestion? Thanks. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] POST, content-type: application/json and json_decode

2012-09-24 Thread Andrew Faulds
On 24/09/12 19:09, Andrew Faulds wrote: I think perhaps that's the wrong approach. It's valid JSON to have a list literal at the top level as well, Excuse my brief brain lapse. PHP arrays are fine for sequential data as well, and you could also have any other JSON literal value in $_POST

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
to properties and not just the property values. Paddy -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
form of untrusted input. It needs to be clear it's a string literal though, and a literal at that. Otherwise it's a little unclear. Still, I'm more worried about the CSS. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http

Re: [PHP-DEV] Re: RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
would be: 1) do we even need encoding or is UTF8 just fine UTF8-only is certainly not just fine. 2) what are the flags to be defined for different escaping methods $.02 -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
no, let's please only do OOP with the language features. Creating ridiculous procedural OOP abstractions helps absolutely nobody. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
-escape($str) and escape($ctx, $str) are essentially equivalent. Besides, examples in the documentation can make this very simple to understand. -- Andrew Faulds http://ajf.me/

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
anyway. Don't complicate things because of personal preference. There is no reason it cannot stay a simple function call or two. Wrap that in as many classes as you wish on your own time. :) What's complex about a method call? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Andrew Faulds
function_name? Resembles C (function pointers!), and unless I'm getting confused, it isn't currently legal syntax for something else. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
. Arguing against this being OOP, which I think is useful and requires, at most, one extra line ($x = new Escaper), is silly. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
where escaping applies, the names even in their shorter forms are fairly obvious as to which context they apply to. I think that specific education is better served with good quality documentation and examples (I'm all for docs with a dose of reality). Fair enough. Paddy -- Andrew Faulds http

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Andrew Faulds
On 19/09/12 18:56, Steve Clay wrote: On 9/19/12 1:19 PM, Andrew Faulds wrote: I completely agree. How about function_name? Resembles C (function pointers!), and unless I'm getting confused, it isn't currently legal syntax for something else. $cb = Foo::doSomething; $cb = foo_doSomething

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Andrew Faulds
On 19/09/12 19:21, Steve Clay wrote: On 9/19/12 2:01 PM, Andrew Faulds wrote: Some other ideas: $cb = (callable) $obj-bar; Ah, but (callable) that won't work for global functions, since (callable) is a cast, and (callable) is not usable as a cast (at least in 5.4.7): $a = (callable)'str

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
of computer science etc. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
processing context, a filter removes. In computer science, but not computer security, it processes. I'm very confused :P -- Andrew Faulds http://ajf.me/

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
like these: escapeHTMLAttribute for attributes, escapeHTMLText for text inside element tags, escapeXMLAttribute and escapeXMLContent, escapeJSStringLiteral, escapeCSSIdentifier, and another needs adding (for url('*') things), escapeCSSStringLiteral. -- Andrew Faulds http://ajf.me/ -- PHP

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
are not realising that filter has a different meaning depending which field it is used in. It has very different meanings in computer science and referring to the physical apparatus, compared to computer security. Since stopping XSS is a computer security issue, we should discuss it as such. -- Andrew

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
) -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
it. Would this minimise the amount of change (if any) ? To some extent, yes, but Rasmus is right in that there would be certain bugs. In C, we don't have implicit string casting, for example. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe

Re: [PHP-DEV] Why are the PHP namespaces different compared to C++?

2012-09-07 Thread Andrew Faulds
different from C++'s shouldn't be a surprise, C++ is quite a different language. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: Moving to an AST-based parsing/compilation process

2012-09-06 Thread Andrew Faulds
. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Sent from my Android phone with K-9 Mail. Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] is GD being actively maintained?

2012-09-06 Thread Andrew Faulds
I briefly asked Pierre about a feature in it recently. By the sounds of it, it is being actively maintained, albeit perhaps slowly. -- Sent from my Android phone with K-9 Mail. Andrew Faulds http://ajf.me/ Rasmus Schultz ras...@mindplay.dk wrote: I opened this bug report 2 years ago: https

Re: [PHP-DEV] Re: Moving to an AST-based parsing/compilation process

2012-09-05 Thread Andrew Faulds
speculating here, but this would be pretty cool if we could do it. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Moving to an AST-based parsing/compilation process

2012-09-04 Thread Andrew Faulds
might be changed, but I would expect no big changes. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Moving to an AST-based parsing/compilation process

2012-09-04 Thread Andrew Faulds
be avoided. Rather, I am saying that I hope any work in this area would give the potential for additional resource usage very serious consideration. Adam -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Release scheduling, branching NEWS for 5.4

2012-09-03 Thread Andrew Faulds
can be removed or replaced) -- Sent from my Android phone with K-9 Mail. Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-03 Thread Andrew Faulds
(Africa/Niamey) Sounds good. -- Ryan McCue http://ryanmccue.info/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Sent from my Android phone with K-9 Mail. Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Andrew Faulds
/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Sent from my Android phone with K-9 Mail. Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] $obj-attr::method() is not allowed

2012-09-03 Thread Andrew Faulds
imagine this could be fixed. We could also add extra rules, but I think fixing the general issue is more important, since it's like plugging two holes in a barrel full of water that's just had a machine gun fired at it. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development

Re: [PHP-DEV] $obj-attr::method() is not allowed

2012-09-03 Thread Andrew Faulds
On 03/09/12 16:20, Ivan Enderlin @ Hoa wrote: Absolutely. PHP has no AST? Why? For historical reasons? I believe so. Rasmus's original parser was not exactly world-class ;) -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http

Re: [PHP-DEV] $obj-attr::method() is not allowed

2012-09-03 Thread Andrew Faulds
, it will because a better parser tool shows up... Well, current one is bad. It only works well for some common cases. For others, it doesn.t -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] $obj-attr::method() is not allowed

2012-09-03 Thread Andrew Faulds
On 03/09/12 17:17, Laruence wrote: On Tue, Sep 4, 2012 at 12:05 AM, Andrew Faulds a...@ajf.me wrote: On 03/09/12 17:03, Laruence wrote: It is great parser(simple and fast) which make php works well for years.. No, it's not, it's overly complex. You have to define all sorts of different

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Andrew Faulds
else in the language anyway. I'm starting to see huge inconsistencies with how list is being implemented in foreach. Possibly more importantly, since 1 should cast to, er, [1] (I think...), why is $a === NULL? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Andrew Faulds
null. Ah, I guess I'm confusing GML and PHP array semantics, somehow... my bad. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Exceptions Vs Errors

2012-09-02 Thread Andrew Faulds
? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-02 Thread Andrew Faulds
more of them. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-02 Thread Andrew Faulds
. If there was a format, it would have to be constant imho. Then ISO8601, please. It's a single, unambiguous Date and Time format. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-02 Thread Andrew Faulds
::ISO8601), \n;' 2012-12-31T00:00:00+ ^ I'm a little confused as to what is going on here, but ISO8601 has a UTC format, -MM-DDTHH:MM:SSZ. cheers, Derick -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-02 Thread Andrew Faulds
On 02/09/12 21:45, Derick Rethans wrote: Yes, and that format is ambigious like I just illustrated. cheers, Derick No, you just demonstrated the time offset format is ambiguous, not the UTC format. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-02 Thread Andrew Faulds
(default in ECMAScript, for instance) date/time format. I see no reason not to use it. Date/time should be UTC anyway when debugging. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-01 Thread Andrew Faulds
on, I'm hoping you can give this RFC a look. - Will Oh, thank you Will! I saw the bug report suggesting it myself and was thinking of implementing it. I'm glad to see you thought the same way I did, and used the ISO-8601 format as the default. +1 from me. -- Andrew Faulds http://ajf.me/ -- PHP

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-08-31 Thread Andrew Faulds
easier to debug if it stopped since then you don't have a strange undefined application state. But that's just my opinion :) -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [VOTE] Generators

2012-08-30 Thread Andrew Faulds
. Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-28 Thread Andrew Faulds
accepted. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-28 Thread Andrew Faulds
On 28/08/12 18:14, Will Fitch wrote: You're right. My apologies. Good, I was a little worried that I might have missed something you didn't. It's all well and good. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-27 Thread Andrew Faulds
standardisation! C++ has better support, of course, but C++'s magic and abstractions don't seem appropriate. -- Sent from Samsung Mobile Andrew Faulds http://ajf.me/ Stas Malyshev smalys...@sugarcrm.com wrote: Hi! That's where it gets ugly, in my experience; there are lots of mediocre C++ developers

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-27 Thread Andrew Faulds
On 27/08/12 15:49, Derick Rethans wrote: On Mon, 27 Aug 2012, Andrew Faulds wrote: Hi derick, can't read the rules now, on mobile. If you're referring to top-posting/bottom-posting though, that's the fault of the Android Gingerbread email client, which sucks. So don't reply from a mobile

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-26 Thread Andrew Faulds
They don't, you need voting karma too, having rfc karma isn't enough. And this is how democracy works, Stas. If voters don't bother to turn up, too bad. -- Sent from Samsung Mobile Andrew Faulds http://ajf.me/ Yahav Gindi Bar g.b.ya...@gmail.com wrote: On Sun, Aug 26, 2012 at 8:42 PM, Stas

Re: [PHP-DEV] Older style frameworks ...

2012-08-25 Thread Andrew Faulds
for :( OK Lester, you've whined enough, what do you want us to do? Freeze development for 5 years so ISPs can slowly catch up, or something? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-25 Thread Andrew Faulds
able to do in Python for years, but with uglier syntax! :P -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Older style frameworks ...

2012-08-25 Thread Andrew Faulds
On 25/08/12 14:27, Lester Caine wrote: Andrew Faulds wrote: OK Lester, you've whined enough, what do you want us to do? Freeze development for 5 years so ISPs can slowly catch up, or something? Simply taking care to provide fixed point that we can work to would have helped. LTS versions

Re: [PHP-DEV] Older style frameworks ...

2012-08-25 Thread Andrew Faulds
On 25/08/12 14:44, Lester Caine wrote: Andrew Faulds wrote: ISPs should have moved to 5.3 long ago. If they haven't, that isn't our problem. I'll just refer you to http://w3techs.com/technologies/details/pl-php/5/all 5.3 is NOT being used because of the changes it introduced

Re: [PHP-DEV] Default input encoding for htmlspecialchars/htmlentities

2012-08-23 Thread Andrew Faulds
to match. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Default input encoding for htmlspecialchars/htmlentities

2012-08-23 Thread Andrew Faulds
On 23/08/12 17:15, Rasmus Lerdorf wrote: On 08/23/2012 09:09 AM, Andrew Faulds wrote: Personally, I think you should have just two encodings: page_encoding and internal_encoding. The former is for form input and page output (could be latin-1, for instance), and internal_encoding is the internal

Re: [PHP-DEV] removing an item from an array

2012-08-22 Thread Andrew Faulds
Um, Yasuo, have you looked at array_walk implementation and ascertained it is safe to change array structure while using it? Because I'm worried you're changing docs without doing so. -- Sent from Samsung Mobile Andrew Faulds http://ajf.me/ Yasuo Ohgaki yohg...@ohgaki.net wrote: Hi, 2012/8

Re: [PHP-DEV] UTF-8 files and include

2012-08-22 Thread Andrew Faulds
Also, beware the unavailable UTF8 filenames on some older/badly configured VPS images. That's bitten me. I now have some files on my VPS with unreadable mangled UTF-8 names, because they were uploaded from my UTF-8-compliant desktop distribution. -- Sent from Samsung Mobile Andrew Faulds http

[PHP-DEV] Huge breach of PHP policy regarding World Domination

2012-08-22 Thread Andrew Faulds
revert the repo immediately. Thanks, comrades. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] On the general standard of discussion...

2012-08-21 Thread Andrew Faulds
and voting on it. Because no sane person could keep track of the Generators thread just now with its ridiculous length. Thank you. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
? Regards, -- Yasuo Ohgaki yohg...@ohgaki.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- -- Tjerk -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
On 21/08/12 21:00, Yasuo Ohgaki wrote: Hi 2012/8/22 Andrew Faulds a...@ajf.me: On 21/08/12 10:36, Yasuo Ohgaki wrote: Int would be better and callable should be accepted like array_walk(). It's better to have array_delete_recursive(), too. I updated the page. Callable? What

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
On 21/08/12 21:32, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds a...@ajf.me: On 21/08/12 21:00, Yasuo Ohgaki wrote: Hi 2012/8/22 Andrew Faulds a...@ajf.me: On 21/08/12 10:36, Yasuo Ohgaki wrote: Int would be better and callable should be accepted like array_walk(). It's better to have

Re: [PHP-DEV] Official Userland Library (was: removing an item from an array)

2012-08-21 Thread Andrew Faulds
On 21/08/12 21:44, Lars Schultz wrote: Am 20.08.2012 22:51, schrieb Andrew Faulds: On 20/08/12 21:43, Lars Schultz wrote: It's a ridiculous argument, IMO. Nothing you could add to core couldn't be implemented in userland code somehow. (yes, that's hyperbole, but there is very often a userland

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
On 21/08/12 22:18, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds a...@ajf.me: Er, so you're advocating adding another method to do the same thing? Why? Because novices don't know about array_walk(). I think I've written this over and over in this thread. So publicise array_walk() then. Don't

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
On 21/08/12 22:35, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds a...@ajf.me: On 21/08/12 22:18, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds a...@ajf.me: Er, so you're advocating adding another method to do the same thing? Why? Because novices don't know about array_walk(). I think I've

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
conventions. (Yasuo, I'm looking at you) Cheers, Levi Morrison Yeah, this looks like a good solution and we have the best of both worlds. We get int array_delete($array, $value, $strict=TRUE); and int array_udelete($array, $value, $callback=bool function ($value $key)); :) -- Andrew Faulds http

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Andrew Faulds
. And there is another use case: removing of list items by value, instead of key. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Andrew Faulds
or not. So let's make an RFC (I think array_delete($array, $value, $all=false), mirrors Python's replace-one-only by default), vote on it, and that can decide things. So we can avoid argument. Don't like the syntax? Vote against it, but I don't see how it could be much better. -- Andrew Faulds

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Andrew Faulds
On 20/08/12 18:43, Sebastian Krebs wrote: Am 20.08.2012 19:00, schrieb Andrew Faulds: On 20/08/12 17:47, Herman Radtke wrote: May be we should have something like array_delete_if($array, function($v, $k=null) { if ($v == 300) return true; }) So array_filter? I'll use it or like

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Andrew Faulds
and use `array_slice`. Want to remove all instances of the value in the array? Use `array_filter`. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Generators

2012-08-20 Thread Andrew Faulds
, but consider type hints mean that if you return a completely wrong type, you can warn the programmer. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Generators

2012-08-20 Thread Andrew Faulds
effect. yield: Yields the value null with an auto-incrementing integer key. What is the usecase for this? cheers, Derick -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Official Userland Library (was: removing an item from an array)

2012-08-20 Thread Andrew Faulds
solution than just saying: it's so simple, do it yourself. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: Generators in PHP

2012-08-19 Thread Andrew Faulds
not modify opcodes for running code. That is a ginormous hack and it *will* cause problems with some code. I can't say much about this in particular, but using hacks and kludges to implement language features is probably not the best of ideas. Derick -- Andrew Faulds http://ajf.me/ -- PHP

Re: [PHP-DEV] re: removing an item from an array

2012-08-19 Thread Andrew Faulds
it or like for deleting, but the point of this thread is intuitive function for deleting element(s) array_delete($array, $value|callable) would be nicer for users, perhaps. A callable? Wouldn't that mean you couldn't delete strings? :( -- Yasuo Ohgaki yohg...@ohgaki.net -- Andrew Faulds http

Re: [PHP-DEV] re: removing an item from an array

2012-08-19 Thread Andrew Faulds
On 20/08/12 00:16, Yasuo Ohgaki wrote: 2012/8/20 Andrew Faulds a...@ajf.me: On 20/08/12 00:05, Yasuo Ohgaki wrote: 2012/8/20 Etienne Kneuss col...@php.net: On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki yohg...@ohgaki.net wrote: 2012/8/18 Rasmus Lerdorf ras...@lerdorf.com: On 08/17/2012 05

Re: [PHP-DEV] re: removing an item from an array

2012-08-18 Thread Andrew Faulds
). Of course there might be better ways to implement this, but it was simple and worked. Anything wrong with allowing the same in PHP? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Combined assignment operator for short ternary

2012-08-18 Thread Andrew Faulds
To unsubscribe, visit: http://www.php.net/unsub.php -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] re: removing an item from an array

2012-08-18 Thread Andrew Faulds
be someone who wants their own particular set of circumstances catered for without having to write their own function to do it. Just my 2¢. -- Andrew Faulds http://ajf.me/

Re: [PHP-DEV] re: removing an item from an array

2012-08-18 Thread Andrew Faulds
On 19/08/12 01:39, Morgan L. Owens wrote: On 2012-08-19 10:25, Andrew Faulds wrote: On 18/08/12 14:52, Morgan L. Owens wrote: How simple is it? Does it: 1) Remove one occurrence of the element (presumably the first) or all? 2) Reindex the array (as someone else argued was necessary to make

Re: [PHP-DEV] Decorators Revisited

2012-08-15 Thread Andrew Faulds
/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] php_basic ...

2012-08-15 Thread Andrew Faulds
://rainbowdigitalmedia.co.uk -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Generators in PHP

2012-08-09 Thread Andrew Faulds
On 09/08/12 16:58, Nikita Popov wrote: On Wed, Aug 8, 2012 at 10:55 PM, Andrew Faulds a...@ajf.me wrote: Hmm. This is just a quick thought: Considering the yield syntax will vary about needing () round it, why not make it a fake function (language construct). This way it's consistent: yield

Re: [PHP-DEV] Generators in PHP

2012-08-08 Thread Andrew Faulds
has enough special cases already IMO. Regards, -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Generators in PHP

2012-08-08 Thread Andrew Faulds
it, why not make it a fake function (language construct). This way it's consistent: yield(), yield($v), yield($k = $v), $a = yield(), etc. (yield $x) is just messy as an expression. We don't have (isset $x), we have isset($x). -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Andrew Faulds
error value. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Andrew Faulds
irritating to debug. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] php interactive shell without readline

2012-08-05 Thread Andrew Faulds
On 05/08/12 19:33, Ivan Enderlin @ Hoa wrote: On 05/08/12 12:39, Andrew Faulds wrote: Great, but couldn't you type some command which would screw it up, by accident? What do you mean? Say your implementation uses some global variable called $history. Now say I type $history

Re: [PHP-DEV] php interactive shell without readline

2012-08-05 Thread Andrew Faulds
On 05/08/12 19:44, Ivan Enderlin @ Hoa wrote: On 05/08/12 20:36, Andrew Faulds wrote: On 05/08/12 19:33, Ivan Enderlin @ Hoa wrote: On 05/08/12 12:39, Andrew Faulds wrote: Great, but couldn't you type some command which would screw it up, by accident? What do you mean? Say your

Re: [PHP-DEV] php interactive shell without readline

2012-08-05 Thread Andrew Faulds
On 05/08/12 22:03, Ivan Enderlin @ Hoa wrote: On 05/08/12 20:56, Andrew Faulds wrote: On 05/08/12 19:44, Ivan Enderlin @ Hoa wrote: On 05/08/12 20:36, Andrew Faulds wrote: On 05/08/12 19:33, Ivan Enderlin @ Hoa wrote: On 05/08/12 12:39, Andrew Faulds wrote: Great, but couldn't you type

Re: [PHP-DEV] php interactive shell without readline

2012-08-05 Thread Andrew Faulds
it use the correct lib at compile-time, no? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] php interactive shell without readline

2012-08-05 Thread Andrew Faulds
On 06/08/12 00:37, Ferenc Kovacs wrote: On Mon, Aug 6, 2012 at 1:22 AM, Andrew Faulds a...@ajf.me mailto:a...@ajf.me wrote: On 06/08/12 00:21, Ferenc Kovacs wrote: On Mon, Aug 6, 2012 at 12:18 AM, Johannes Schlüter johan...@schlueters.de mailto:johan

[PHP-DEV] Should we have some sort of isset()-like operator with default?

2012-08-04 Thread Andrew Faulds
to implement, but I think it needs discussing before implementing, I am not going to rush. Thanks. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] php interactive shell without readline

2012-08-04 Thread Andrew Faulds
into? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Integrate PECL into PHP

2012-08-04 Thread Andrew Faulds
extensions from userland would go beyond fatal. Nikita Aren't shared hosting servers pretty well secured, though? If each site is under a different userid, surely it can't do much damage? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe

Re: [PHP-DEV] Add runkit to PHP Runtime

2012-08-03 Thread Andrew Faulds
Lester, you complain about practically everything being complicated/breaking compatibility/not working with PHP 5.2. Why complain here? It doesn't help the signal:noise ratio to moan about something which has no direct effect on you. -- Sent from Samsung Mobile Andrew Faulds http://ajf.me

Re: [PHP-DEV] Why do disabled functions / classes generate a WARNING.

2012-08-03 Thread Andrew Faulds
are special, they aren't really errors as such. They wouldn't become exceptions. Also, why should an erroring function return a value? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Why do disabled functions / classes generate a WARNING.

2012-08-03 Thread Andrew Faulds
into E_RECOVERABLE_ERROR. Which in turn could be turned into Exception by an userland error handler if the php userland developer wishes it. Why not just have them exceptions in the first place? -- Ferenc Kovács @Tyr43l - http://tyrael.hu -- Andrew Faulds http://ajf.me/

  1   2   3   >