php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #74620 new function pls
Submitted: 2017-05-21 09:05 UTC Modified: 2017-05-22 14:11 UTC
From: mags at inbox dot ru Assigned:
Status: Wont fix Package: *General Issues
PHP Version: Next Major Version OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mags at inbox dot ru
New email:
PHP Version: OS:

Further comment on this bug is unnecessary.

 

 [2017-05-21 09:05 UTC] mags at inbox dot ru
Description:
------------
In which patch will be added a global array of servers, whose data is always in the server's memory and available for all scripts. Each script can be changed. 

Test script:
---------------
client1.php

$map[1][4] = "test";
$_GLOBAL_ARRAY["MAP"] = $map;

client2.php;

$map = $_GLOBAL_ARRAY["MAP"];
print_r($map);


result in screen "test";

Expected result:
----------------
result in screen "test";

Actual result:
--------------
not have function now

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-21 09:09 UTC] requinix@php.net
-Status: Open +Status: Wont fix -Package: PHP Language Specification +Package: *General Issues
 [2017-05-21 09:10 UTC] requinix@php.net
Use a session or caches.
 [2017-05-21 21:51 UTC] mags at inbox dot ru
session this very slow while wait memory copy
+ session not work for all server

catch to slow while wait load.
global map around 1000-3000mb need wait 3-5 sek for load

need fast server memory for all script always loaded
 [2017-05-21 22:09 UTC] spam2 at rhsoft dot net
> global map around 1000-3000mb need wait 3-5 sek for load

it is *not* the job of a programming language to store such amount of data between requests - just get APCu or memcached - you confuse programming lanuguage with frameworks
 [2017-05-22 08:24 UTC] mags at inbox dot ru
Memcashed has a bunch of restrictions since it does not support the execution of code inside itself, speed and ending with the fact that it is third-party.
The shared memory of the server that is always loaded into zend structures and immediately ready for work would be much more convenient and faster.

In PHP there are many global arrays why not make another one, for those who need to do something quickly and conveniently.

Imagine a common map for all customers is 100 million values ​​and it is not known in advance which ones are necessary, they can be requested only by 1.
How long it would have been on memcashed or the database is minutes or tens of minutes and how quickly when it's already loaded during script execution less than a second.
 [2017-05-22 08:45 UTC] mags at inbox dot ru
Imagine you need to find a way between two cities in a large graph for example Google maps where millions of cities.

You do not need data about all cities. If there is a common array this is easy, you immediately look for it on the path. If the memcashed database or something else you load all the cities for a very long time.
 [2017-05-22 08:52 UTC] spam2 at rhsoft dot net
your application design is broken - learn about databases, indexes and so on
 [2017-05-22 10:26 UTC] mags at inbox dot ru
"spam2 at rhsoft dot net "  
if i wanna google map or game server 

"your application design is broken" ? realy?

or PHP need +1 global array and all ok?
 [2017-05-22 12:55 UTC] mags at inbox dot ru
variant 2 for hard use

to get "inplace array constructor" from mmap resource.
So I would preload and fill such array once and reuse in each instance of a script on same server.
 [2017-05-22 12:59 UTC] spam2 at rhsoft dot net
Status: Wont fix

while i am not a php upstream-developer: PLEASE stop it - you have to realize that such border cases don't belong into the core of a programming language

frankly you even don't gasp the implication if more than one vhost is running on the same server and unlrelated scripts modify a shared data ressource, not speaking abotu the security implication

when you need such a feature either write a php-extension in C/C++ and/or consider your application design broken from the start
 [2017-05-22 13:34 UTC] mags at inbox dot ru
That improvement require special flag in to exclude that array from garbage collection,
 [2017-05-22 14:11 UTC] requinix@php.net
-Block user comment: No +Block user comment: Yes
 [2017-05-22 14:11 UTC] requinix@php.net
There's nothing to be gained by debating this on a bug tracker. @mags, if you feel so strongly that you're willing to champion this idea then bring it to the internals mailing list. But don't get upset if others tell you the same things you've heard here.
http://php.net/mailing-lists.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 09:01:27 2024 UTC