Maybe someone can help in the finalization Fiber.
Haitao Lv, in pull request asked for help from Dmitry Stogov and
Nikita Popov, but no one answered him.
https://github.com/php/php-src/pull/3203
All popular web programming languages (JavaScript, Python, Ruby, Lua,
etc..) already implement
Fiber and all async functions, without event-loop - useless.
Need new PHP Application Server.
Best variant `libuv` in core PHP for event-loop and async I/O, and
implementing as async PHP SAPI as `Nginx Unit` module
http://unit.nginx.org/
Thanks.
--
PHP Internals - PHP Runtime Development
If you implement scalar objects:
https://github.com/nikic/scalar_objects
Then 80% of global functions (array_*, str_*) will be localized using
scalar object methods ($array->split(), $string->join()) and the PHP
developer's response will be positive.
Thanks.
--
PHP Internals - PHP Runtime
This has already been discussed in github
Fiber::resume()
https://github.com/fiberphp/fiber-ext/issues/7
Fiber::throw()
https://github.com/fiberphp/fiber-ext/issues/6
Keywords - async/await
https://github.com/fiberphp/fiber-ext/issues/10
I believe that current API is normal for the Pecl ext,
2017-08-15 13:52 GMT+03:00 Rasmus Schultz :
> The following GD issue is all-too common:
>
> https://stackoverflow.com/questions/5773032/how-to-stop-gd2-from-washing-away-the-colors-upon-resizing-images
>
> Basically anyone who's ever accepted uploaded images and resized or
>
2017-06-29 2:13 GMT+03:00 Stanislav Malyshev :
> Hi!
>
>> Back in 2014 there was an informal proposal on the mailing list to replace
>> PHP serialization with an efficient binary (msgpack) format.
>
> Why replace? If you have it as an extension, can't people that want to
> use
> 7.1.5 PGO: Requests per second: 886.63
> 7.2.0 JIT PGO: Requests per second: 925.96
>
> OK, than it are "only" 5% on a highly optimized codebase
Try PHP script as daemon mode, will speed up 2x
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:
> +1
> Can be used, for convert NAMESPACE to filepath in autoload )
>
>
> function __autoload($path)
> {
> include convert_seperators($path);
> }
>
>
> On Windows, it is what realpath does.
>
No, realpath() - is not used `include_path`
--
PHP Internals - PHP Runtime Development Mailing
> Another option would be to create a function that converts all slashes in a
> given input string to whatever the directory seperator should be on that
> platform. This way, devs wouldn't have to deal with bulky aliases like
> DIRECTORY_SEPERATOR cluttering up their code.
>
> For example:
>
>
>
> The project is in the very early development stage.
>
> Now, JIT passes almost all PHPT tests, makes 3 times speed-up on bench.php
> and no significant difference on real-life apps (+/-5% depended on
> opcache.jit setting.
>
Have you tried to measure in frameworks as PHP script daemon, such
Is planned async/await and native event-loop (maybe libuv)?
Thank.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
May be better to do as immutable arrays?
const EmailObject = new Email;
It will be a super global immutable instance of Email.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
May be better to do as immutable arrays?
const = new Email;
it will be a super global immutable instance of Email.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
+1
There is use case - exception without backtrace, used to global return.
Example REST API
throw new RedirectExeception('/url', 302); // creating in backtrace is overhead
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
2016-05-20 17:41 GMT+03:00 Niklas Keller <m...@kelunik.com>:
> 2016-05-20 15:34 GMT+02:00 S.A.N <ua.san.a...@gmail.com>:
>>
>> Many interfaces work with callback functions, but they might work with
>> the generators, if there was a method Generator::__invok
Many interfaces work with callback functions, but they might work with
the generators, if there was a method Generator::__invoke($value).
I apologize if this topic has been discussed.
Thank.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:
> I don't think we should wait, I was just thinking that it might not be ready
> until that time.
>
> Also, if we plan on rewriting streams and I/O to all be async and use libuv
> underneath, that would probably be a BC break unless the existing functions
> just become blocking interfaces for a
>> /Legend speaks of such plans, but they come and go in whispers. Like a
>> shadow, or a mist from the east. The prophecy spake of such features
>> targeting PHP8; lo, most believe it to be myth./
>
>
> Why do we have to wait until PHP 8? Should be mostly backwards compatible
> and be fine in 7.2
> I think we can spoonfeed the massive undertaking a bit by spreading it
> across several iterations just to get things going. An idea I had was to
> just begin by providing coroutines as part of the language. That would
> include a `\Coroutine` class, as well as await / async keywords. This would
2016-04-26 10:44 GMT+03:00 Remi Collet <r...@fedoraproject.org>:
> Le 25/04/2016 à 16:09, S.A.N a écrit :
>> In userland lacks the ability to store data in the shared memory
>> modules, do not use pecl modules, it would be very nice to have a
>> function:
>>
>
> Meanwhile, you haven't addressed the point being made as a reason not to
> bundle, which is that this is not a universally-useful solution, and there
> needs to be some reason why this needs to be incorporated - under whatever
> name - any more urgently than a memcache driver, or a redis driver,
2016-04-25 20:56 GMT+03:00 Rowan Collins <rowan.coll...@gmail.com>:
> S.A.N wrote on 25/04/2016 18:49:
>>>
>>> There's not really a huge connection between opcode caching and
>>> optimization
>>> >(OpCache) and shared memory data caches (APCu, memc
2016-04-25 17:36 GMT+03:00 Rowan Collins <rowan.coll...@gmail.com>:
> S.A.N wrote on 25/04/2016 15:09:
>>
>> In userland lacks the ability to store data in the shared memory
>> modules, do not use pecl modules, it would be very nice to have a
>> function:
>&g
In userland lacks the ability to store data in the shared memory
modules, do not use pecl modules, it would be very nice to have a
function:
opcache_get($key);
opcache_set($key, $value);
Is planned in PHP 7.1?
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:
2016-04-19 19:54 GMT+03:00 David Zuelke :
> I think this solution is merely a band-aid for a more profound architectural
> weakness of current PHP setups, where a web server call out to the engine
> (via embedding or FastCGI) to execute a script, which causes this recurring
>
2015-04-28 11:29 GMT+03:00 Johannes Ott :
> Am 13.04.2015 um 15:37 schrieb Johannes Ott:
>> Hi,
>>
>> finally I managed to do my first RFC draft.
>>
>> https://wiki.php.net/rfc/static_class_constructor
>>
>> I hope I have done everything correct so far and I'm looking forward to
2016-04-12 18:36 GMT+03:00 Midori Koçak :
> what is sugar?
>
Here is a description:
https://en.wikipedia.org/wiki/Syntactic_sugar
But my proposal, almost not realistic implement, although I may be
mistaken... ;)
--
PHP Internals - PHP Runtime Development Mailing List
To
Maybe even more sugar? :)
getValueFromDB();
// Methode getValueFromDB() called, if $value not transmitted or null value
public function __construct($value ??= $this->getValueFromDB())
{
//...
}
public function getFromCache()
{
// Methode getValueFromDB() called, once upon init static
Maybe in the future when there will be an inline object {}, you will
need to make the destructuring {}
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Often all keys are unknown, or a very lot keys, use list(...) - is unreal.
I would like to, instead $value)
{
$this{$key} = $value
}
Use the short syntax sugar
It's really do?
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
2016-02-12 16:27 GMT+02:00 Rowan Collins <rowan.coll...@gmail.com>:
> S.A.N wrote on 12/02/2016 13:37:
>>
>> Often all keys are unknown, or a very lot keys, use list(...) - is unreal.
>>
>> I would like to, instead >
>> foreach($params as $key
2016-02-12 16:55 GMT+02:00 Rowan Collins <rowan.coll...@gmail.com>:
> S.A.N wrote on 12/02/2016 14:39:
>>
>> 2016-02-12 16:27 GMT+02:00 Rowan Collins <rowan.coll...@gmail.com>:
>>>
>>> S.A.N wrote on 12/02/2016 13:37:
>>>>
>
2016-02-12 17:15 GMT+02:00 Rowan Collins <rowan.coll...@gmail.com>:
> S.A.N wrote on 12/02/2016 15:13:
>>
>> But is also necessary and the function or operator like
>> object_assign($target, ...$sources)
>
>
> Like I say, for that kind of purpose, I'd ju
> How feasible would it be to add an exception to mixed keys? I'm thinking
> list(7 => $a, $b, $c, $d) to specify an initial offset, similar to how you
> can define an array as [7 => 0, 1, 2, 3]. This obviously goes hand in hand
> with my desire for variable keys :)
I would like it to be like,
It looks like, destructuring assignment, in ES6
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
I like! )
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
> Implementing elegant, readable, and stable asynchronous code in userland PHP
> code is very possible. In fact, I’ve done exactly this with Icicle
> (https://github.com/icicleio/icicle). Icicle uses generators and promises to
> implement coroutines. When a coroutine yields a promise, the
Are there any future plans for - async/await?
This need to know now, not to use these words to constants, and class names...
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
+1 Yes, it is useful to have in the PHP core.
Possible names: $_BODY, $_DATA, $_INPUT, $_REQUEST
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
I like many the developers of PHP, write JS lot code, very beg you, if
you can do syntax in ECMAScript 6 (=>)
Thank.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
2015-07-23 18:10 GMT+03:00 Marcio Almada marcio.w...@gmail.com:
Hi, you replied to the wrong thread ;)
2015-07-22 19:38 GMT-03:00 S.A.N ua.san.a...@gmail.com:
I am satisfied, the possibility of group declarations, but the that lack:
?php
use App\RestException\ // name RestException
I am satisfied, the possibility of group declarations, but the that lack:
?php
use App\RestException\ // name RestException, not imported to
current namespace :(
{
Gone,
NotFound,
BadRequest
};
?
Unfortunately have to write so:
?php
use App\RestException;
use App\RestException\
Maybe implement getter/setter as ECMAScript 6?
class Person
{
get name ():string { return $this._name }
set name (string $value) { $this._name = $value }
}
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Yes, I think the compiler could compile the expression
class Bar
{
public Foo $foo; // That is shorthand getter/setter...
}
to
class Bar
{
get foo():Foo {return $this-_foo};
set foo(Foo $obj) {$this-_foo = $obj};
}
--
PHP Internals - PHP Runtime Development Mailing List
To
Of course the main target - check types, but not all use the check
types, but almost everyone uses Ide, so I said, it is actual and
useful.
I do not see contradictions, everyone who wants to write PHP 5 code,
need use DocBlock @var.
I hope that in the PHP 7.x, DocBlock is only for documentation
+1
It will be useful for autocomplete in IDE
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
You ideally just check if the divisor is 0 and then do the operation.
And at that point, we should just throw the DivisionByZeroError.
Honestly, a warning is just the wrong thing to use. Either you enable it
(like double division in C) or disable it completely (runtime exception in C).
I
Tons of things in PHP or in libraries called by PHP are
blocking
Yes, it's not a problem, thread pools for use blocking processes do
not block the main process Nginx.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
New versions Nginx, implement thread pools,
http://nginx.com/blog/thread-pools-boost-performance-9x/
I think this is a good opportunity to write a Nginx module (PHP SAPI)
which is to process requests for PHP scripts in processes Nginx.
Quality advantages, as compared with the FPM, no network
If there is someone willing to implement this (and maintain it), I
don't see any reason for why this could not be accepted into PHP. I
would expect such, if implemented by someone, to first be available in
7.1.0, although we could do exceptions like we did for FPM which came
in 5.3.3 or
?php
const CONST_ARRAY =
[
'key' = 'value'
];
isset(CONST_ARRAY['key']); // Fatal error: Cannot use isset() on the
result of an expression (you can use null !== expression instead)
?
It is design, or a bug?
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:
It is by design; the documentation states[1]:
| isset() only works with variables as passing anything else will
| result in a parse error.
[1]
http://php.net/manual/en/function.isset.php#refsect1-function.isset-notes
Ok, the way it works in PHP 7.
But the speed of access to const the
There was some discussion on contant arrays on Stackoverflow with an
answer by Andrea Faulds (with a link to changes between 5.6 and 7.0):
http://stackoverflow.com/a/27413238/872051
Ok, thank.
Why the speed of access to const the array ARR['key'] is 500% slower,
in comparison with the
Foo::bar();
Output for 5.0.0 - 5.6.8, php7@20140507 - 20150501, hhvm-3.6.0 - 3.7.0bar
http://3v4l.org/F6tXZ
2015-05-12 21:44 GMT+03:00 Bishop Bettini bis...@php.net:
class Foo {
public static function bar() { echo 'bar'; }
}
Foo:bar();
Note the single colon. According to 3v4l
$object is not guaranteed to be an object, it could be anything (int,
string, etc) or nothing (null). using ::class for a variable, I'd argue,
makes for less consistency. What would the replacement be for non-object
variables? An error, exception, or false, or string type? At least in
Now this code causes an error PHP 5-7.
PHP Parse:
Syntax error, unexpected 'class' (T_CLASS), expecting identifier
(T_STRING) or variable (T_VARIABLE) or '{' or '$'
Do not want to use get_class($object)
Thank.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:
Why not?
Seriously, why not? ::class was added because there was no easy way to
get from the symbol class name to the string representation of it (you
couldn't pass it to a function, etc since it would look like a
constant). So ::class is a purely compile time construct to turn a
literal
2015-04-27 20:33 GMT+03:00 Nicolas Grekas nicolas.gre...@gmail.com:
Systems that depend on `get_class()` a lot would
An for non-objects types, I suggest that $var::class could return the same
as get_type($var). That would allow saving ref mismatches when $var is a
ref.
+1
--
PHP Internals
Okay I will think about the alternative names, I somehow like
__classInit you proposed or __classConstruct
I like simple: __init()
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
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
$object-method($methodArg1, $methodArg2); };
$object-$methodName(...$args);
--
Someone got an idea ?
Simply arrows, without word this
?php
class Addition {
private $number
public function __construct($number) {
$-number = $number;
}
public function original() {
return $-number;
}
public function addTo($amount) {
return $-number + $amount;
}
}
2015-03-02 2:17 GMT+02:00 Terry Cullen te...@terah.com.au:
On 2 March 2015 at 01:18, S.A.N ua.san.a...@gmail.com wrote:
Maybe better implement for method calls on primitive types in PHP 7?
https://github.com/nikic/scalar_objects
I've searched through the internals archive looking for debate
Maybe better implement for method calls on primitive types in PHP 7?
https://github.com/nikic/scalar_objects
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Would have been more useful, inline sintex like JSON:
$object =
{
'property': $value,
'method': function (){...}
};
$object-property;
$object-method();
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
2015-02-24 20:49 GMT+02:00 Philip Sturgeon pjsturg...@gmail.com:
On Tue, Feb 24, 2015 at 1:37 PM, S.A.N ua.san.a...@gmail.com wrote:
Would have been more useful, inline sintex like JSON:
$object =
{
'property': $value,
'method': function (){...}
};
$object-property;
$object
2015-02-15 21:04 GMT+02:00 Patrick Schaaf p...@bof.de:
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
2015-02-14 2:38 GMT+02:00 Leigh lei...@gmail.com:
On 14 February 2015 at 00:32, Benoit Schildknecht bensor...@neuf.fr wrote:
I don't think EngineException should inherit from Exception, it would be
very dangerous. I'm sure a lot of exceptions are handled like this by a lot
of devs, without
2015-02-11 13:25 GMT+02:00 Dmitry Stogov dmi...@zend.com:
yes. some special attributes. requires/ensures/invariant
Oh, and syntax is *ugly* ;)
It's from HHVM. I don't like it as well, please, propose the better one.
I like syntax, like a switch:
function add(int $a, int $b) : int
2015-02-10 14:26 GMT+02:00 Rowan Collins rowan.coll...@gmail.com:
Rowan Collins wrote on 09/02/2015 18:24:
I just realised the double negative in that sentence may not be easy to
understand, so just to make sure it's clear: I do quite like the idea, in
general, but think it would require a
2015-02-09 12:41 GMT+02:00 Rowan Collins rowan.coll...@gmail.com:
Yes, I can see it working well for specialised uses - you can simply not use
those aspects of the language that don't make sense. But for it to be a
mainstream part of the language, it needs to play nicely with other parts of
Hi internals.
I really hope that in the future PHP 7, there will be new server API.
May be you interested to know about them, here is the link, I am not
the author of development:
https://github.com/unbit/uwsgi-phpsgi/
But the problem is that in PHP there are no standards for such interfaces.
2015-02-09 2:26 GMT+02:00 Rowan Collins rowan.coll...@gmail.com:
On 09/02/2015 00:02, S.A.N wrote:
You're right, but there is no threading issues.
One worker synchronously execute requests, but may run parallel many
workers.
I'm not sure what you mean by this. I can see 3 ways of handling
2015-02-09 1:48 GMT+02:00 Rowan Collins rowan.coll...@gmail.com:
On 08/02/2015 22:48, S.A.N wrote:
Hi internals.
I really hope that in the future PHP 7, there will be new server API.
May be you interested to know about them, here is the link, I am not
the author of development:
https
We all external data convert to native PHP types.
The database we use option MYSQLI_OPT_INT_AND_FLOAT_NATIVE.
HTTP inputs are validated and converted to native PHP types.
In Redis data are stored as serialize string.
Strong typing I like.
--
PHP Internals - PHP Runtime Development Mailing List
2015-02-02 21:12 GMT+02:00 Andrea Faulds a...@ajf.me:
Hi Dmitry,
On 2 Feb 2015, at 18:22, Dmitry Stogov dmi...@zend.com wrote:
So, one of the advantages of strict type hinting is the ability to catch
potential errors.
For example when we pass 67 to setBody(string $message).
Yes, that
2015-02-01 21:41 GMT+02:00 Rowan Collins rowan.coll...@gmail.com:
On 31/01/2015 23:42, S.A.N wrote:
Yes, you're right, in PHP you can solve this problem by other methods, i
know...
But the problem is that PHP is no nice and convenient for solving this
problem.
So i suggested to add new
= $c;
$a-object-getHolder(); // return A
$b-object-getHolder(); // return B
$c-getHolder(); // Fatal Error - undefined context
?
What do you think?
Thank.
2015-01-30 18:43 GMT+02:00 Ferenc Kovacs tyr...@gmail.com:
On Fri, Jan 30, 2015 at 3:53 AM, S.A.N ua.san.a...@gmail.com wrote:
The reason
2015-02-01 2:23 GMT+02:00 Stanislav Malyshev smalys...@gmail.com:
Hi!
If the caller explicitly send the object as an argument, it worsens
loose depending API.
And agreed this code looks weird and not well thought-out:
?php
$holder-object-call($holder);
This code explicitly says
2015-02-01 0:10 GMT+02:00 Rowan Collins rowan.coll...@gmail.com:
On 31/01/2015 19:41, S.A.N wrote:
No, I'm not describing this behavior, but I chose the wrong name
keyword, this is not perceived correctly.
My source code examples, it is clear that no returns previous object
from the call
2015-02-01 1:52 GMT+02:00 Stanislav Malyshev smalys...@gmail.com:
Hi!
The reason for creating circular references, usually due to the need to
bind objects.
But this relationship can often be obtained from the context of the call.
If the API behaves differently depending on who is calling
constructor and
C object storing it in some attribute, solving the problem. I don't think a
new keyword would help.
Juan Basso
On Thu, Jan 29, 2015 at 9:53 PM, S.A.N ua.san.a...@gmail.com wrote:
The reason for creating circular references, usually due to the need to
bind objects
The reason for creating circular references, usually due to the need to
bind objects.
But this relationship can often be obtained from the context of the call.
It will be very convenient to have a keyword that will return reference to
an object, which caused this object.
Sorry for my English,
storing it in some attribute, solving the problem. I don't think a
new keyword would help.
Juan Basso
On Thu, Jan 29, 2015 at 9:53 PM, S.A.N ua.san.a...@gmail.com wrote:
The reason for creating circular references, usually due to the need to
bind objects.
But this relationship can often
Many developers PHP offers dual syntax:
1. Strict
function bar(int $num){}
2. Lax
function bar((int) $num){}
Maybe it makes sense to put this option on the ballot if it passes a vote,
it will be possible to put an end to the discus?
The main advantage of the two syntaxes:
1. Strict
function bar(int $num){}
2. Weak
function bar((int) $num){}
Any junior-middle PHP developer, seeing this syntax in the code can
understand how it works, without studying the documentation and without
your complex conversion tables.
Explicit is
Syntax forced cast, it makes sense not only for scalar types, but also for
instances of classes.
Is a syntactic sugar can be realized
?php
class User
{
public function __construct(int $id)
{
..
}
}
function printPerson((User) $object)
{
var_dump($object);
return
I always wanted to have an analog XPath to access the array elements.
Something like:
?php
$array = ['x' = ['p' = ['a' = ['t' = ['h' = 'value'];
$xpath = ['x', 'p', 'a', 't', 'h'];
$value = $array[...$xpath];
var_dump($value); // string(5) value
?
This is certainly a topic for another
That would be quite confusing, we don’t allow $array[‘x’, ‘p’, ‘a’, ’t’,
‘h’] just now.
Andrea Faulds
Yes, I know, but it would be convenient, maybe someone will offer the best
option syntax.
What would happen if some key from `$xpath` is undefined on the
multidimensional `$array`?
Notice: Undefined index...
Return NULL.
Me as a user and developer PHP RESTful, enough auto filling the global
variable.
Make an abstract variable names (_BODY or _FORM), and filled with the value
in all the HTTP methods.
Perhaps it makes sense to do lazy loading of data in these variables, it is
simply done through an ArrayAccess
If this is difficult, you can do in PHP 7.0 simple realization
annotation/facades, in versions 7.x to develop and refine.
Most importantly, define the syntax and semantics annotation/facades, for a
version of PHP 7.0
Demand in annotation/facades is very high, ~80% of all popular frameworks
their
Nothing magical in the annotations no, they very obvious.
It gives you the to declare logic and meta data.
I do not like annotated in comments, I like the implementation of
annotation in C#
2014-11-04 0:49 GMT+02:00 Levi Morrison le...@php.net:
On Mon, Nov 3, 2014 at 10:39 AM, Larry Garfield
91 matches
Mail list logo