[PHP-DEV] get_class_vars() returned information ORDER

2012-09-09 Thread Patrick Schaaf
Hi, I'm curious whether the ORDER of the class properties returned by get_class_vars(), is in some way guaranteed. I do not find mention of it in the documentation. I'm especially interested in the order of static class variables returned. Testing, using PHP 5.4.6, I find that there seems to be

Re: [PHP-DEV] get_class_vars() returned information ORDER

2012-09-09 Thread Patrick Schaaf
Thanks Sherif and all, for your answers. So I will not rely on the order returned by get_class_vars (or get_class_methods), instead adding suitable code (actually roughly one additional line per class involved) to define my desired ordering by hand. If you're curious, the use case I was thinking

Re: [PHP-DEV] [VOTE] ::class feature to resolve namespaced class names to scalars

2012-09-14 Thread Patrick Schaaf
Hi, if it looks, smells, and works like a class constant, can't just BE a class constant, automatically created, but just as-if const class = 'xxx'; had been present in the definition in the first place? Not that I know php code internals in any thorough way, but I imagine that that approach

Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability

2012-10-26 Thread Patrick Schaaf
I'm all for having the internal methods being totally normal magic methods, for the reduced complexity reasons already mentioned. I would also expect to be able to simply define such a magic method myself, and have it behave in just the same way as when defining it using the accessor declaration

Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability

2012-10-27 Thread Patrick Schaaf
- i.e. name them __prop_get_xxx, __prop_set_xxx, and so on. I think it'd more natural to make it __set__PROPNAME. Though __set_state is a static method, so maybe we can live with it - except that you won't be able to declare property named $_state. Needing an except is inelegant, if it can

Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability

2012-10-27 Thread Patrick Schaaf
On Saturday 27 October 2012 13:05:27 Clint Priest wrote: That's why I think they shouldn't even be visible to users, they aren't relevant to them and in fact it could mis-lead them into thinking that they could simply define __getHours() and expect $foo-Hours to call it, which it wouldn't. I

Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability

2012-10-28 Thread Patrick Schaaf
Am 28.10.2012 02:42 schrieb Clint Priest cpri...@zerocue.com: Sounds like you're implying that the mere existence of a properly named function such as __prop_get_hours() would cause it to be called instead of returning the property. Only when the property does not exist, just like it is with

Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability

2012-10-31 Thread Patrick Schaaf
Nikita, your examples convinced me that a strict accessor methods as specialized __get/__set semantics approach is undesirable. To recapitulate your two examples: Example 1: class A { public $foo; } class B extends A { public $foo { get() { ...} } } Example 2: class A { public $foo {

Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability

2012-11-14 Thread Patrick Schaaf
On Wednesday 14 November 2012 16:35:31 Nikita Popov wrote: On Wed, Nov 14, 2012 at 2:27 PM, Clint Priest cpri...@zerocue.com wrote: Been AWOL for a while and getting back to this, doesn't seem like any resolution has occurred, just the conversation has died down. I got the feeling that in

Re: [PHP-DEV] [RFC] Property Accessors v1.2 : Internal Accessor Method Visibility / Callability

2012-11-19 Thread Patrick Schaaf
Am 19.11.2012 16:41 schrieb Nikita Popov nikita@gmail.com: On Wed, Nov 14, 2012 at 5:24 PM, Patrick Schaaf p...@bof.de wrote: class ... { no methodname(); // or no $property; } Removing methods from an extending class is an LSP violation. I see LSP as a best practise

Re: [PHP-DEV] Crashes in lex_scan at Zend/zend_language_scanner.c / BUG #52752

2012-12-20 Thread Patrick Schaaf
On Thursday 20 December 2012 10:40:32 Stas Malyshev wrote: Hi! ?php if ($argv[1] 0) { while ($argv[1]--) file_put_contents('test.tpl', ?php #.str_repeat('A', mt_rand(4000, 5000)). ?\n, LOCK_EX); } else { $p2 = popen(sapi/cli/php -n test3.php 100, r); while (1)

Re: [PHP-DEV] Crashes in lex_scan at Zend/zend_language_scanner.c / BUG #52752

2012-12-21 Thread Patrick Schaaf
On Thursday 20 December 2012 23:23:43 Stas Malyshev wrote: Hi! Is include supposed to take a LOCK_EX somehow? I can neither see that in php- src (5.4.9) nor APC-trunk, doing a cursory grepping. I'm not sure how any lock would help, since locks are optional, meaning you still can do the

Re: [PHP-DEV] Crashes in lex_scan at Zend/zend_language_scanner.c / BUG #52752

2012-12-21 Thread Patrick Schaaf
On Friday 21 December 2012 10:41:59 Jani Ollikainen wrote: So, my conclusion would be that it is the code snippet above, and not any part of PHP or the kernel, that is at fault. Oh? Did I understand you correctly? If you can code PHP that crashes PHP, it's that codes fault not PHP's

Re: [PHP-DEV] Crashes in lex_scan at Zend/zend_language_scanner.c / BUG #52752

2012-12-21 Thread Patrick Schaaf
I understood you correctly using temp file and then rename should fix that? Like this? file_put_contents('test.tpl.tmp', ?php #.str_repeat('A', mt_rand(4000, 5000)). ?\n, LOCK_EX); rename('test.tpl.tmp','test.tpl'); Exactly! You could also do it like this: $tmpname =

Re: [PHP-DEV] [RFC] Alternative typehinting syntax for accessors

2013-01-06 Thread Patrick Schaaf
Was it considered to augment type hinting syntax - both in parameter lists and for the hinted property RFC - to permit giving multiple types at once? public DateTime|DateTimeImmutable $refdate; public Foo|NULL $object; // the issue discussed in the previous msgs function bar(array|string $arg)

Re: [PHP-DEV] - True Annotations

2013-01-09 Thread Patrick Schaaf
Regarding syntax... Would this work? |foo| |bar( |baz| )| best regards Patrick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [VOTE] Deprecate and remove calls from incompatible context (example of real usage that will break)

2013-01-29 Thread Patrick Schaaf
On Monday 28 January 2013 21:46:27 Stas Malyshev wrote: I understand that there's a tendency to use OO as a neat way to namespace global functions and autoload them, but that's not how it is supposed to work. I've seen that sentiment against using static methods several times now, and it

Re: [PHP-DEV] FILTER_VALIDATE_INT and +0/-0

2013-02-04 Thread Patrick Schaaf
+0 and -0 don't make sense for integers, where there is only 0. Allowing only 0 was on purpose. +0 and -0 are accepted by sscanf('%d'), intval(), and (int). +0 is produced by sprintf('%+d') Thus, the change to FILTER_VALIDATE_INT seems to make sense. best regards Patrick -- PHP Internals

Re: [PHP-DEV] Zend Optimizer+ Source Code now available

2013-02-14 Thread Patrick Schaaf
On Thursday 14 February 2013 10:24:22 Stas Malyshev wrote: For most scripts, optimizations are not really worth it unless you run the same code over and over, so for CLI it would be noticeable only if you run long-running CPU-intensive server. Apart from the long-running servers, there is

Re: [PHP-DEV] __invokeStatic() method

2013-03-19 Thread Patrick Schaaf
On Tuesday 19 March 2013 02:54:19 Bruno CHALOPIN wrote: Now I don't see why in the world a class and a function could share the same name. Well, for one, I might have code like this: class Foo { public static the_usual() { static $instance; if

Re: [PHP-DEV] Continued try blocks

2013-04-26 Thread Patrick Schaaf
On Friday 26 April 2013 16:41:17 Julien Pauli wrote: *try {* * foo();* * bar();* * baz();* *} catch (SomeException $e) {* *dosomestuff();* *continue; /* Here is the feature, go back to try block */* *} catch (Exception $e) {* *dosomething();* *}* ... So, in this

Re: [PHP-DEV] date.timezone E_WARNING -- Really necessary? What's the rationale?

2013-05-24 Thread Patrick Schaaf
Am 24.05.2013 18:45 schrieb Derick Rethans der...@php.net: On Fri, 24 May 2013, Leszek Krupiński wrote: I was wondering - why not get time zone info from operating system? It's should be quite easy on both *nixes and Windows. That way default value would be from operating system, with

Re: [PHP-DEV] PR 287 - added use_keys argument to array_filter() [Discussion]

2013-06-18 Thread Patrick Schaaf
var_dump(array_filter(['foo', '', 'bar'], 'strlen', true)); Warning: strlen() expects exactly 1 parameter, 2 given in - on line 1 Not only do we trigger the error handler (a large enough array causes a performance issue), but we also get back an empty array as a result. That's BC and

Re: [PHP-DEV] New feature: sequential constructors

2013-07-03 Thread Patrick Schaaf
For what it's worth, some time ago I prototyped something like that, without modifying the language, in the form of a Universal class that you may inherit from without defining __contruct/__destruct yourself. See class definition below. In a using class (herarchy) define static methods

RE: [PHP-DEV] [RFC] Constant Scalar Expressions

2013-08-14 Thread Patrick Schaaf
Would this allow using constants, too? Class constants? const FOO = 1; const BAR = self::FOO + 1; const BAZ = self::FOO + 2; const BARF = GLOBAL_BARF; const IMPORT = otherclass::IMPORT; // with autoloading? In my opinion these would start to make the feature useful. Even more useful, but

RE: [PHP-DEV] [RFC] Constant Scalar Expressions

2013-08-14 Thread Patrick Schaaf
Am 14.08.2013 13:03 schrieb Derick Rethans der...@php.net: On Wed, 14 Aug 2013, Patrick Schaaf wrote: Would this allow using constants, too? Class constants? const FOO = 1; const BAR = self::FOO + 1; Those are not constants, but expressions which can't be run during compile time

Re: [PHP-DEV] [RFC] Constant Scalar Expressions

2013-08-16 Thread Patrick Schaaf
Am 16.08.2013 01:42 schrieb Stas Malyshev smalys...@sugarcrm.com: But this is not the most tricky part. The most tricky part is this: if(true) return; class Foo { const halfpie = M_PI/2; } Now what happens if this is implemented as an opcode? We can't run any opcodes past return

Re: [PHP-DEV] Wake up

2013-09-11 Thread Patrick Schaaf
On Wednesday 11 September 2013 15:00:33 Daniel Basten wrote: cite: I hope this is a joke. i guess that is the stuff they where talking about. Yeah. A forum would be much better, this whole thread could just be moderated shut and invisible after the first message. Also a forum would avoid

Re: [PHP-DEV] RFC: Anonymous Classes

2013-09-23 Thread Patrick Schaaf
Am 23.09.2013 16:06 schrieb Joe Watkins krak...@php.net: On 09/23/2013 02:43 PM, Lars Strojny wrote: what about serialization for those classes? Same as any other object; what you are creating is normal classes without a (declared) name, nothing about the objects functionality has differs

Re: [PHP-DEV] RFC: Anonymous Classes

2013-09-26 Thread Patrick Schaaf
Am 26.09.2013 11:29 schrieb Nicolas Grekas nicolas.grekas+...@gmail.com: Btw, I can't get used to ($val) beeing at the end of the declaration. I feel it very confusing. I feel the same. Couldn't this (constructor arguments) be moved? $that = new class(/* constructor args */) /* extends X

Re: [PHP-DEV] RFC: Anonymous Classes

2013-09-26 Thread Patrick Schaaf
Am 26.09.2013 12:16 schrieb Joe Watkins krak...@php.net: For the following reasons the syntax should remain as it is: It is consistent with anonymous function calls - args after definition ... I think it is exceedingly rare for anynomous functions to be called at their point of

Re: [PHP-DEV] RFC: Expectations

2013-10-21 Thread Patrick Schaaf
Am 21.10.2013 03:52 schrieb Joe Watkins krak...@php.net: So looks like we need a new name ?? Ideas ?? abstract EXPRESSION abstract is already a keyword, so no BC. abstract is not concrete so alludes a bit to the might-be-or-might-not-be-checked nature of the test abstract is the name for the

Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

2014-07-24 Thread Patrick Schaaf
The argument saying that it is not the PHP way is somehow incorrect here, given that we already do that for classe. The type jungling makes sense in implementations, as it always was but argument passing and validation have been a source of pain since very long. I could imagine one exception

Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

2014-07-24 Thread Patrick Schaaf
Hi, there is, it seems, something missing from both the RFC and the discussion, as far as I read it. Sorry if it came up before, it was a huge amount of mails... How does the proposal affect method compatibility between subclasses and baseclasses? Will two methods there, differing in the

Re: [PHP-DEV] Remove generated VM from git?

2014-08-27 Thread Patrick Schaaf
On Tuesday 26 August 2014 21:30:16 Andrea Faulds wrote: Why would a non-internals person want to build PHP from git? That’s just making things harder on themselves. I disagree. The build environment I scripted together for myself, initializes a build tree (php-src and various extensions)

[PHP-DEV] PHP 5.6 frontpage links funny on php.net + mirrors

2014-08-29 Thread Patrick Schaaf
Hi, just noticed that the PHP 5.6 related links on the php.net frontpage of mirrors, all point back to http://php.net/ instead of pointing to the respective mirror. Is that intentional? Apart from that: the link for Variadic functions (second bullet in the main features announcement),leads to

Re: [PHP-DEV] PHP 5.6 frontpage links funny on php.net + mirrors

2014-08-29 Thread Patrick Schaaf
On Friday 29 August 2014 10:57:57 Ferenc Kovacs wrote: Apart from that: the link for Variadic functions (second bullet in the main features announcement),leads to manual lookup because function.arguments.php doesn't exist

Re: [PHP-DEV] PHP 5.6 frontpage links funny on php.net + mirrors

2014-08-29 Thread Patrick Schaaf
On Friday 29 August 2014 11:59:50 Ferenc Kovacs wrote: in the meantime, could you please report a bug about this, so that we won't forget it (and there is a chance that somebody else can also help figuring out what's happening here). https://bugs.php.net/bug.php?id=67931

Re: [PHP-DEV] [VOTE][RFC] Null Coalesce Operator

2014-09-20 Thread Patrick Schaaf
Am 20.09.2014 01:35 schrieb Andrea Faulds a...@ajf.me: https://wiki.php.net/rfc/isset_ternary#vote Hi, got a question after being bitten my the issue yesterday in the context of the @yadda ?: 'default' form yesterday: What about yadda that results, at the moment, in fatal errors?? Things like

Re: [PHP-DEV] [RFC] Loop... or...

2014-09-21 Thread Patrick Schaaf
Am 21.09.2014 02:22 schrieb Sara Golemon poll...@php.net: It would also mean having to make { default block } into an expression... with a return value (to be allowed on either side of the boolean or) Excellent point, a block only works with T_OR if it has a value. I'm pretty sure that

Re: [PHP-DEV] Invokation on __toString() for object used as array key

2014-09-24 Thread Patrick Schaaf
Am 24.09.2014 22:01 schrieb Andrea Faulds a...@ajf.me: Now, if we were to add actual object key support, that I might like. But if we’re going to keep with just integers and strings, I’d much prefer to just support __toString here. I think users are smart enough to understand that PHP arrays

Re: [PHP-DEV] [RFC] Exceptions in the engine

2014-10-10 Thread Patrick Schaaf
Looking at the list of fatal errors Nikita classified as not suitable for converting to exceptions, I'd like to take exception : ) with two of them: I would love to be able to catch, at toplevel. with an error handler or otherwise, both the memory limits exceeded and time limit exceeded cases.

Re: [PHP-DEV] [RFC] Readonly Properties

2014-10-24 Thread Patrick Schaaf
Am 24.10.2014 01:36 schrieb Andrea Faulds a...@ajf.me: Here’s another RFC: https://wiki.php.net/rfc/readonly_properties +1 for the general feature, I'd love to have that available. I have an idea regarding the additional keyword, with a small implication (improvement) to the functionality

Re: [PHP-DEV] [RFC] Using objects as keys

2014-10-27 Thread Patrick Schaaf
Am 27.10.2014 02:37 schrieb Stas Malyshev smalys...@gmail.com: I would like to present to your attention an RFC about using object as keys: https://wiki.php.net/rfc/objkey I don't like this, mainly because it blocks a future direct use and storage of objects as keys in an array, i.e. what

Re: [PHP-DEV] [RFC] Using objects as keys

2014-10-27 Thread Patrick Schaaf
Am 27.10.2014 08:09 schrieb Stas Malyshev smalys...@sugarcrm.com: I don't like this, mainly because it blocks a future direct use and storage of objects as keys in an array, i.e. what SplObjectStorage does. It does not. It just allows the objects to control how they are seen when they are

Re: [PHP-DEV] PHP 5.6.3 is available

2014-11-13 Thread Patrick Schaaf
Hello, there was discussion, one or two weeks ago, about session module changes being reverted to counter regressions with some session handler locking issues. As I experienced slowdown probably related to that when testing 5.6.2 recently (using memcache session handler), I'm curious: are these

[PHP-DEV] Session Lazy Write (was Re: [PHP-DEV] PHP 5.6.3 is available)

2014-11-14 Thread Patrick Schaaf
Yasuo, Am 15.11.2014 02:27 schrieb Yasuo Ohgaki yohg...@ohgaki.net: I've asked this issue on this list and there wasn't much opinion. I'm rather put the feature in PHP 7, since 3d party session save handler module need to adopt new API to get most out of it. Since master has new code, I'll

Re: [PHP-DEV] New function: spl_object_id() or spl_object_handle()

2014-11-28 Thread Patrick Schaaf
On Friday 28 November 2014 14:51:55 Ferenc Kovacs wrote: I also used spl_object_hash() in the past when traversing/custom serializing object structures which can have infinite recursions between objects, but even that could be simply solved by storing the already traversed objects in an

Re: [PHP-DEV] New function: spl_object_id() or spl_object_handle()

2014-11-28 Thread Patrick Schaaf
Am 28.11.2014 20:23 schrieb Bostjan Skufca bost...@a2o.si: On 28 November 2014 at 04:10, reeze re...@php.net wrote: Won't `$obj1 === $obj2` work for you ? Think of it like this: - in file bootstrap.php I see this object initialized and passed somewhere - in file view.phtml I receive the

Re: [PHP-DEV] [RFC] Static classes (Was Abstract final classes)

2014-12-01 Thread Patrick Schaaf
Am 01.12.2014 17:37 schrieb Rowan Collins rowan.coll...@gmail.com: guilhermebla...@gmail.com wrote on 01/12/2014 15:27: (1) Function/Namespaced function autoloading (2) State encapsulation (3) Function scoping I would add (4) static polymorphism, which Late Static Binding explicitly

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-06 Thread Patrick Schaaf
Am 06.12.2014 04:04 schrieb Yasuo Ohgaki yohg...@ohgaki.net: $top = array_pop(f2()); is better than $v = f2(); $top = array_pop($v); Is there anyone who likes latter? It is bad practise either way, having poor f2() build up a whole array that is then immediately thrown away. The second

RE: [PHP-DEV] On the road to PHP 5.7 , or not ?

2014-12-15 Thread Patrick Schaaf
Am 15.12.2014 20:43 schrieb Zeev Suraski z...@zend.com: The extra pain associated with migrating to an interim version - that does nothing but spew warnings in the right places -and obviously doesn't have any of the other features of 7 - doesn't seem to be a worthwhile experience for most

Re: [PHP-DEV] [RFC][VOTE] Objects as Keys

2014-12-16 Thread Patrick Schaaf
Am 16.12.2014 12:36 schrieb Matteo Beccati p...@beccati.com: On 16/12/2014 11:52, Andrea Faulds wrote: I was previously in favour of this, but it’d prevent actual indexing by objects in future, and I can’t think of any use cases which aren’t better solved by explicitly converting to a

Re: [PHP-DEV] JSON HASHDOS

2014-12-24 Thread Patrick Schaaf
Hi all, Am 24.12.2014 10:47 schrieb Yasuo Ohgaki yohg...@ohgaki.net: On Wed, Dec 24, 2014 at 6:29 PM, Pierre Joye pierre@gmail.com wrote: I do not see how it solves the problem. It only reduces it, slightly. Having a couple of medium instances generating crafted requests will just

Re: [PHP-DEV] Design by Contract

2015-02-05 Thread Patrick Schaaf
Am 05.02.2015 12:14 schrieb Dmitry Stogov dmi...@zend.com: For php it may look like the following: function foo() require(input-assert-expression) ensure(output-assert-expression) { ... } It would require only one new reserved word ensure. How would one access the function

Re: [PHP-DEV] Design by Contract

2015-02-05 Thread Patrick Schaaf
On Thursday 05 February 2015 15:14:04 Dmitry Stogov wrote: function foo() requre(input-assert-expression) ensure(output-assert-expression) { ... } It would require only one new reserved word ensure. Regarding syntax This could be another place where the irrationally-

[PHP-DEV] I declare declare to be useful... potentially...

2015-02-08 Thread Patrick Schaaf
Am 08.02.2015 03:39 schrieb Rasmus Lerdorf ras...@lerdorf.com: Basically declare() does not respect function scope, but it doesn't let you know that. There is a reason we haven't used declare() for anything real. That is absolutely awful. But it's a fault with declare. Can't that be fixed

Re: [PHP-DEV] [RFC] Skipping parameters take 2

2015-01-16 Thread Patrick Schaaf
Am 14.01.2015 20:50 schrieb Simon J Welsh si...@welsh.co.nz: create_query(deleted=0, name, _, _, true); Still not sure if it's better than `default`, though. That would be a BC break as you can currently have a constant _. A visually pleasing (IMO), even easier to type, and non-BC

Re: [PHP-DEV] [RFC][DISCUSSION] Script only includes

2015-02-11 Thread Patrick Schaaf
Hi, another one of my weird ideas: what about a script signing mode? - ini setting containing a HMAC key - first ?php tag in a file must then have a signature, a la ?php:Base64encodedstring - no parsing of files that fail the signature check - (maybe optional) disabling of eval Of course such

Re: [PHP-DEV] Re: [RFC] Exceptions in the engine

2015-02-19 Thread Patrick Schaaf
One question just popped up in my mind: what happens if there is a global error handler in place that rethrows errors as exceptions. I heard such a thing suggested pretty often. If not parse errors and other engine errors get thrown as exceptions and are unhandled as such, and that error handler

Re: [PHP-DEV] [VOTE] Expectations

2015-02-20 Thread Patrick Schaaf
Am 20.02.2015 09:47 schrieb Joe Watkins pthre...@pthreads.org: Also, we don't optimize those away, it would not be sensible, because it's not sensible to deploy those catch blocks in the first place. So, do they become FATAL with production settings? Ideally a parse error (ideally, because

Re: [PHP-DEV] How does the PHP Ghost one-liner work

2015-01-30 Thread Patrick Schaaf
Am 30.01.2015 20:09 schrieb Leigh lei...@gmail.com: Well, I guess in theory we should be limiting the size of input to gethostbyname to 255 characters. Yeah, but in theory the C library gethostbyname() should do the same... There will be a lot of things that could be checked up-front instead

Re: [PHP-DEV] How does the PHP Ghost one-liner work?

2015-01-30 Thread Patrick Schaaf
Am 30.01.2015 19:43 schrieb Robert Williams rewilli...@thesba.com: % php -r '$e=0;for($i=0;$i2500;$i++){$e=0$e;} gethostbyname($e);’ What a funny way to say gethostbyname(str_repeat(0, 2501)); does this indicate any problems with PHP? No. best regards Patrick

Re: [PHP-DEV] Use caller keyword, to access object caller.

2015-02-01 Thread Patrick Schaaf
Am 01.02.2015 01:15 schrieb S.A.N ua.san.a...@gmail.com: $holder-object-call($holder); The way I solve this in the very few places (*) where it makes sense, is to use __call in the holder class to implement forwarding methods that pass on the holder object reference. The member property is NOT

Re: [PHP-DEV] Design by Contract

2015-02-09 Thread Patrick Schaaf
Am 10.02.2015 07:25 schrieb Yasuo Ohgaki yohg...@ohgaki.net: https://wiki.php.net/rfc/dbc2 First of all, thanks for your effort so far. Some questions, after reading the RFC, with no particular order: 1) Regarding invariants: those will be called for method calls on objects. What about static

Re: [PHP-DEV] Design by Contract

2015-02-09 Thread Patrick Schaaf
Am 10.02.2015 08:08 schrieb Yasuo Ohgaki yohg...@ohgaki.net: One reason I would like to use __invariant() is to allow overriding parents. I think we should have way for it, but I don't have good idea now. I'm still thinking. Hmm, Idea... Imagine the require keyword, in the context of classes,

Re: [PHP-DEV] Design by Contract

2015-02-09 Thread Patrick Schaaf
Am 10.02.2015 08:25 schrieb Yasuo Ohgaki yohg...@ohgaki.net: 5) and a bit off-topic, it would be useful to be able to declare (sic) whole methods to be nonproduction only: Methods that will only be used in pre/post/invariant condition expresions (or error formatters a la my point 4) Do you

Re: [PHP-DEV] Design by Contract

2015-02-10 Thread Patrick Schaaf
Am 10.02.2015 09:29 schrieb Dmitry Stogov dmi...@zend.com: I cnahged $ into $ret, because $ just won't work. Some better solution is welcome. Also think $ would be awful. Don't like $ret either. What about a magic constant __RETURN__ or __RESULT__? This would stand out very well when glancing

Re: [PHP-DEV] Design by Contract

2015-02-10 Thread Patrick Schaaf
Am 10.02.2015 12:45 schrieb Alexander Lisachenko lisachenko...@gmail.com : DbC is good thing, but the way you want to do this via language changes is really awful. Why do you want to add more custom features into the language, instead of providing an API to extend it in a more natural way by

[PHP-DEV] A modest proposal: __contructStatic

2015-02-15 Thread Patrick Schaaf
Hello Internals, seeing the static calling of instance methods being discussed again, I want to ask whether the following idea would maybe have a chance? In our codebase we have one set of classes where it was very useful to be able to call the same methods both statically and nonstatically: a

Re: [PHP-DEV] A modest proposal: __contructStatic

2015-02-15 Thread Patrick Schaaf
Am 15.02.2015 21:05 schrieb Rowan Collins rowan.coll...@gmail.com: This sounds to me like you should just be using the Singleton pattern, Of course this is singleton under the hood. // Now wherever in the code you want the default instance, just use this: $value =

Re: [PHP-DEV] A modest proposal: __contructStatic

2015-02-15 Thread Patrick Schaaf
Am 15.02.2015 23:34 schrieb Rowan Collins rowan.coll...@gmail.com: You can surely see how this is more readable / easier to write: $value = MyRedir::get($key); Actually, no, I find that harder to read accurately - there is no clue there that there is actually a singleton under the hood, and

Re: [PHP-DEV] A modest proposal: __contructStatic

2015-02-15 Thread Patrick Schaaf
Am 16.02.2015 02:40 schrieb Kris Craig kris.cr...@gmail.com: I've never really done any work with Redis before so I'm also having trouble understanding the use case for this given that everybody's talking about this solely in the context of Redis. Ahem, it's not everbody, just me :) And the

Re: [PHP-DEV] A modest proposal: __contructStatic

2015-02-15 Thread Patrick Schaaf
Am 16.02.2015 00:05 schrieb Rowan Collins rowan.coll...@gmail.com: A quick thought - if you want to stick with the magic static call pattern, you can implement this much more simply by doing something similar to Laravel's facades [1]: ... This basically implements in userspace what you propose

Re: [PHP-DEV] RFC: Nested enclosing returns

2015-03-22 Thread Patrick Schaaf
Am 21.03.2015 14:15 schrieb Georges.L cont...@geolim4.com: The main purpose, as the title say, is to have the possibility to nest multiple return like we can do currently with break/continue. I think that is a complete nonstarter. Functions are reusable building blocks, designed to be called

Re: [PHP-DEV] To RFC or Not To RFC [was Re: [PHP-DEV] 回复: [RFC][DISCUSSION] Add preg_replace_callback_array function]

2015-03-22 Thread Patrick Schaaf
Am 22.03.2015 09:45 schrieb Leigh lei...@gmail.com: On 22 March 2015 at 07:00, Patrick Schaaf p...@bof.de wrote: Hmm. Is that really the line to be drawn? An RFC, by itself, provides a good point to spell out a change clearly, and anchor it for reference in discussion. Discussion on internals

Re: [PHP-DEV] Re: SAPI apache2handler + pipelined HTTP request core dumps

2015-03-15 Thread Patrick Schaaf
Respin of my patch for https://bugs.php.net/bug.php?id=68486 is now available as a gist here: https://gist.github.com/bof/15173c7a11cb12a7b96f Some comments on the respin are in the bug report at [2015-03-15 10:17 UTC] Debug cruft has been removed, and as far as my brain can make out this is

Re: [PHP-DEV] Re: SAPI apache2handler + pipelined HTTP request core dumps

2015-03-15 Thread Patrick Schaaf
Am 15.03.2015 11:20 schrieb Patrick Schaaf p...@bof.de: Respin of my patch for https://bugs.php.net/bug.php?id=68486 is now available as a gist here: https://gist.github.com/bof/15173c7a11cb12a7b96f Some comments on the respin are in the bug report at [2015-03-15 10:17 UTC] Debug cruft

[PHP-DEV] PHP apache2handler virtual() function

2015-03-16 Thread Patrick Schaaf
Hi, working on bug 68486 I had a look at the apache2handler virtual() function. This function, as vaguely documented, is intended to make an Apache subrequest, without terminating the currently running request, i.e. run whatever is behind a different URI (given as an argument to virtual().

[PHP-DEV] Re: PHP apache2handler virtual() function

2015-03-16 Thread Patrick Schaaf
On Monday 16 March 2015 10:31:46 Patrick Schaaf wrote: Furthermore, I have a working prototype of changing the behaviour of virtual() in the following way: _remember_ which subrequest should be made, but then only really make it when the current request ends (php_handler

[PHP-DEV] new wiki account / requesting RFC karma

2015-03-19 Thread Patrick Schaaf
Dear internals, I just registered my own php.net account, username bof. This is the obligatory introduction mail I'm supposed to send :) TL;DR: I think I know what I'm doing, and currently I'm requesting RFC karma. I'm mainly working as a system administrator. As part of my job I'm supporting

Re: [PHP-DEV] To RFC or Not To RFC [was Re: [PHP-DEV] 回复: [RFC][DISCUSSION] Add preg_replace_callback_array function]

2015-03-22 Thread Patrick Schaaf
Am 22.03.2015 02:30 schrieb Leigh lei...@gmail.com: Yep, this does look like another case of simply ignoring rules. The fact that what does and does not require an RFC does not help, this probably didn't need one, however one was created and the rules need to be stuck to. Hmm. Is that really

Re: [PHP-DEV] static constructor

2015-03-12 Thread Patrick Schaaf
On Thursday 12 March 2015 00:10:15 Rowan Collins wrote: On 11/03/2015 23:21, Johannes Ott wrote: The purpose of this suggestion is to introduce a static constructor, which is called before the first call to class either static or non-static to initialize some static properties which are

Re: [PHP-DEV] static constructor

2015-03-12 Thread Patrick Schaaf
On Thursday 12 March 2015 00:21:34 Johannes Ott wrote: The purpose of this suggestion is to introduce a static constructor, which is called before the first call to class either static or non-static to initialize some static properties which are needed by the class. We are doing this in our

Re: [PHP-DEV] [RFC] Anonymous Classes

2015-03-06 Thread Patrick Schaaf
Am 06.03.2015 20:14 schrieb Philip Sturgeon pjsturg...@gmail.com: Right, this here RFC has been drastically improved. https://wiki.php.net/rfc/anonymous_classes Anyone got any doubts or troubles at this point? Can we / could we do extends self, extends static, or even extends $someclassname

Re: [PHP-DEV] SAPI apache2handler + pipelined HTTP request core dumps

2015-03-13 Thread Patrick Schaaf
Am 13.03.2015 18:26 schrieb Bostjan Skufca bost...@a2o.si: If we create unconditional php_server_context_cleanup() call at the beginning of php_request(), would that be out of order? Does it remove also all context-dependent configuration? That's exactly what my Minipatch (addition of 1 ||) is

Re: [PHP-DEV] Re: SAPI apache2handler + pipelined HTTP request core dumps

2015-03-13 Thread Patrick Schaaf
Am 13.03.2015 18:18 schrieb Jan Ehrhardt php...@ehrhardt.nl: https://bugs.php.net/bug.php?id=68486 echo -e GET /test.php HTTP/1.1\nHost: localhost\n\n \ GET /test.php HTTP/1.1\nHost: localhost\n\n|nc localhost 80 Are you running opcache? I tried to reproduce the bug on a Centos6

Re: [PHP-DEV] Re: SAPI apache2handler + pipelined HTTP request core dumps

2015-03-14 Thread Patrick Schaaf
Possible patch for the issue at https://gist.github.com/bof/15173c7a11cb12a7b96f with an explanatory comment in the bug report https://bugs.php.net/bug.php?id=68486 at [2015-03-14 10:34 UTC] Have a nice weekend Patrick -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] static constructor

2015-03-12 Thread Patrick Schaaf
Am 12.03.2015 17:28 schrieb Larry Garfield la...@garfieldtech.com: I thought it sounded familiar. Also check the list archive for A modest proposal: __constructStatic from a month ago. It was rejected then, too. That proposal was about a completely different issue. But you are right, it was

Re: [PHP-DEV] SAPI apache2handler + pipelined HTTP request core dumps

2015-03-13 Thread Patrick Schaaf
On Tuesday 10 March 2015 10:26:12 Patrick Schaaf wrote: https://bugs.php.net/bug.php?id=68486 Meanwhile I did some more debugging, today also testing with a freshly compiled current apache 2.4.12. The issue persists. As it does not always coredump, but always uncontrollably reenters

Re: [PHP-DEV] static constructor

2015-03-12 Thread Patrick Schaaf
Am 12.03.2015 18:56 schrieb Rowan Collins rowan.coll...@gmail.com: Johannes Ott wrote on 12/03/2015 17:05: So doing a null check each time is a overhead of calculation which can be avoided with this static constructor pattern. Presumably the engine would need to perform some implicit

Re: [PHP-DEV] static constructor

2015-03-12 Thread Patrick Schaaf
Am 12.03.2015 20:12 schrieb Dan Ackroyd dan...@basereality.com: Patrick Schaaf wrote: But that has proven, in the past, a fountain of joy wrt. placement, with variations needed for APC and opcache, and general frustration all around. Is there a bug report for the problems? OPCache

[PHP-DEV] SAPI apache2handler + pipelined HTTP request core dumps

2015-03-10 Thread Patrick Schaaf
Dear internals, can somebody knowledgeable about the apache2handler code, please have a look at the following bug report? https://bugs.php.net/bug.php?id=68486 I just added a comment with a hotfix that appears to work at first glance, but I'm completely unsure whether that will result in

Re: [PHP-DEV] What's our official stance on small self-contained additions in a micro version

2015-03-31 Thread Patrick Schaaf
Am 31.03.2015 22:45 schrieb Rowan Collins rowan.coll...@gmail.com: - Up until the first release candidate of x.y.0, small features can be added to both the most recent live branch and the new branch being prepared for release (so, right now, 5.6.x and 7.0-pre; next summer, 7.0.x and 7.1-pre). -

Re: [PHP-DEV] [VOTE] Expectations

2015-02-28 Thread Patrick Schaaf
Am 28.02.2015 19:32 schrieb Crypto Compress cryptocompr...@googlemail.com : class BankAccount { function Add($amount) { assert($amount 0); // ... code block ... } } Now the programmer implementing code block to gracefully handle $amount 0 has a problem. There is

Re: [PHP-DEV] [RFC Discuss] Generator Delegation

2015-03-01 Thread Patrick Schaaf
Am 02.03.2015 00:52 schrieb Daniel Lowrey rdlow...@php.net: I'd like to initiate discussion on a proposal to implement generator delegation via the following new syntax inside generator functions: yield * expr The Generator Delegation RFC is available here:

Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls

2015-03-19 Thread Patrick Schaaf
On Thursday 19 March 2015 18:17:50 S.A.N wrote: Then how would you write an callback containing an already constructed object? $a = [$object, 'method']; The alternative is unnecessarily cumbersome: $a = function($methodArg1, $methodArg2) use($object) { return

RE: [PHP-DEV] Preload scripts and preloaded scripts only options

2015-05-16 Thread Patrick Schaaf
None of this whitelisting-by-filename would be practical for our setup. Have a look at what Smarty does with compiled templates and cached pages: PHP includes generated on the fly, with filenames that are not known in advance. For such usage a whitelisting per realpath prefix, would be the only

Re: [PHP-DEV] Preload scripts and preloaded scripts only options

2015-05-16 Thread Patrick Schaaf
Am 16.05.2015 16:32 schrieb Johannes Schlüter johan...@schlueters.de: That whitelist is called open_basedir. http://php.net/manual/en/ini.core.php#ini.open-basedir Ahem. open_basedir is neither a list, nor is is restricted to restricting include/require, which is the topic Yasuo is musing to

Re: [PHP-DEV] Exception message cleanup

2015-04-09 Thread Patrick Schaaf
Am 09.04.2015 10:04 schrieb Nikita Popov nikita@gmail.com: New message: UnexpectedValueException: Failed to open directory in %s on line %d ... Essentially exceptions would display like ordinary error, but with Fatal error / Warning / ... replaced by the exception name, and showing a

  1   2   >