« first day (3066 days earlier)      last day (1896 days later) » 

1:34 AM
@rjhdby do you mean other than the manual php.net/manual/en/features.gc.php
 
Wes
1:46 AM
$array = [];
$array[] = &$array;
is there a way to avoid infinite recursive traversal programmatically in scenarios like this one?
like "hey you already traversed this" stop now
 
Wes
2:04 AM
oh lol the new rfc from niki is precisely about this
but why no ReflectionReference::fromVariable("varName") ? @NikiC
 
Wes
2:19 AM
wasn't it better to have an id for the zval, rather than an id for the reference?
 
Wes
2:39 AM
aaaand i can't compile mbstring
WARNING: mbstring not enabled; libraries and headers not found
 
 
1 hour later…
3:46 AM
pcre_get_compiled_regex_cache->coredump – #77714
 
 
1 hour later…
5:23 AM
@Jincowboy Don't spam
 
Hello All Great People around the globe
Let me know your valuable opinions in the current era about the below statement from the PHP Manual :
"PHP has support for the WDDX complex data exchange between virtually all Web programming languages."
 
I want to know your opinions about the validity and practicality of this statement in the current era of using JSON for cross-platform data-exchange.
 
@PHPLover json can't be validated by default
 
@PeeHaa : I think all the necessary validations should be performed in PHP before the data get converted to JSON. Then there will be no need of any JSON validation. What you say about this?
 
5:34 AM
I say it's bullshit :p
 
@PeeHaa : Do you mean WDDX is bullshit?
 
@PHPLover No. I am calling your statement about validation bullshit :)
> Then there will be no need of any JSON validation
 
@PeeHaa : Then you explain me why the validation of JSON is needed?
 
wddx is afaik specifically for exchanging data between systems
@PHPLover Because you cannot trust random things to send you correctly structured data
There is a reason people spend time on things like json schema
 
@PeeHaa : "wddx is afaik specifically for exchanging data between systems". I think JSON also does the same thing in more easy manner.
@PeeHaa What's the reason?
 
5:38 AM
@PHPLover Make an educated guess
And/or actually see what I have been telling you this conversation
Or read the website of json schema
Or read up about schema validation in generic
If you receive data from random sources you better make sure it's what you expect it to be
 
@PeeHaa : Yes, you are right.
 
Not saying one should use wddx though :P
Just noting that xml (although verbose as fuck) actually had some things going for it
 
Hey @Danack do you have a compiled list of lectures by you?
 
 
1 hour later…
7:06 AM
hi, @PeeHaa
why couldn't i say that?
isn't this forum for some topics?
I had been checked some trump article before.
 
Because it is spam
If I want to see advertisements I will just turn my ad-blocker off and browse the internet instead
 
Wes
\o
 
When using opcache to dump bytecode (php -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.optimization_level=0 -d opcache.opt_debug_level=0x20000 script.php), (how) can I prevent execution of the script?
Has somebody already created a node visitor for ext/ast that emits GraphViz/DOT?
 
7:37 AM
you can't prevent it
 
:-(
With VLD I can set vld.execute=0 and it does not execute.
Was hoping for something similar.
 
yeah ... opcache is all about the execution :)
 
8:00 AM
cap-a-pie from head to foot
 
8:45 AM
Hello guys, I'm trying to start cmd and calling delete file command using php. When you start cmd and write command to delete a file, it will ask you as Yes or No, so there is one more interaction comes. How to pass the multiple commands at a time or how to pass parameter as 'Y' stating 'Yes' after execution of the delete command in the same cmd window. I tried using php code as: exec('start cmd.exe @cmd /k "del /f C:\Users\David\Desktop\11.txt"');
 
 
1 hour later…
Wes
10:13 AM
mornings 2
hey joe
references are insane
Pass by ref is insane > Only variables can be passed by reference why does it even care of what I am doing in my scope?
 
10:50 AM
@bwoebi thank you for clarification ) So, all serialized pointers are just relative address to the script base address. Linear model of mem allocation per each script was not expected for me )
@NikiC ok, this answer is reasonable, but we still have some limitations in language. Serialization is much more complex.
@NikiC so, if don't have an ability to control the whole ser/de process, then it limits us. Crafting object instance from an arbitrary data would be perfect. Either from XML, Json or whatever else...
 
Is it a known issue that the SSL certificate for guide.room11.org has expired?
 
@NikiC and what about my first question about adding second optional array argument for context. Use case is typical: to restore connections, closure callbacks, etc... And prevent global/static variables usage during unserialization
 
@Danack This documentation is helpful, but very superficial.
 
11:40 AM
@Wes Because I couldn't think of a use case for that
In any realistic scenario you'll be interested in arrays or objects
If you do have some case where this would be useful, please share
 
Wes
is the id the id of the zval? i did some tests and it looks like it
 
@Wes id of the reference
zvals themselves don't really have a meaningful id concept
 
Wes
i have a monumental migraine... i am doing this references thing just because i want to provide full support
i am getting a different id for what i think it's the same reference
i don't get why it changes :(
 
@Wes code?
 
Wes
ah, i know what it is
$iteratorFactory = function($o){
    yield from $o;
};
how do i return by ref?
i am iterating two arrays in parallel so i am using this
 
11:50 AM
@Wes Generally by writing function&(), but I'm not sure if yield from supports it
 
Wes
        $iteratorFactory = function&(&$o): Generator{
            foreach($o as &$v){
                yield &$v;
            }
        };
this worked
 
@Wes no it didn't
That yield &$v should be just yield $v
 
Wes
it didn't?
 
What you're doing right now is (yield) & $v I believe :D
 
Wes
lol
 
11:52 AM
yep :-D
call-time-pass-by-ref is disabled since 5.4 :-P
 
Wes
indeed it didn't
i have no idea at all about references... never used them except with use() in closures
 
@lisachenko That would at least in principle be possible... Not sure if a good idea to require additional state for unserialization
 
Wes
unrelated: i couldn't compile mbstring on windows on the 7.4 branch
WARNING: mbstring not enabled; libraries and headers not found
 
@Wes do you have up to date sdk?
 
Wes
yes
 
11:56 AM
you need oniguruma to build mbstring
 
Wes
well, not today's
it's like 2 days old
 
okay, the change is not that recent :D
@Wes report a bug ^^
 
Wes
ok, where? on the win php sdk repo? or bugs.php.net?
 
@Wes bugs.php.net should be fine
 
Wes
kk
 
11:58 AM
/me waves
 
Wes
\o
> Only variables can be passed by reference
can someone explain why does it care
 
@Wes If you pass a non-variable then modifications through the reference will not be possible, which is likely a bug
 
Good morning, room!
 
Wes
it assumes i want to use a reference for writing, maybe i want to use it for reading only
 
@Wes in that case, why are you using a reference?
If you don't write to it, you shouldn't use a reference
 
Wes
12:04 PM
if i don't do & i lose the ability to stop at a circular dependency
 
you do?
 
Wes
yes, i need a second iteration so that i can reach the "original root reference" again
what a bad idea i had lol.... writing code with pass by ref
i knew i would end up fighting it
 
Bulgarian (bg) mirror is not working – #77715
 
Wes
$iteratorFactory = function&(&$o): Generator{
foreach($o as &$v){
yield $v;
}
};
is it possible that public function &current() is not actually &current ?
 
@Wes yes, it's not
 
Wes
12:13 PM
so that's the problem... lemme try with a custom iterator
 
iterators don't support by-ref iterator
generators (and our dear friend ArrayObject) support it by integrating with internal APIs, but it's not going to work if you go through the Iterator interface
 
Wes
i don't understand? so &current is not going to work?
 
nope
 
Wes
you say it works with generators... how?
 
@Wes in foreach
 
Wes
12:18 PM
damnit, won't work for me, need to parallelize
 
@Wes okay, i guess an iterator is going to work then, if you only need it for manual calls, not foreach
 
Wes
you mean a custom iterator with &current ?
 
yes
though not sure why you'd even bother with an iterator
 
Wes
need to iterate in parallel
            $aIterator = new MyIter($a);
            $bIterator = new MyIter($b);

            while($aIterator->valid()){
                ...

                $aIterator->next();
                $bIterator->next();
            }
still no luck :'(
 
@Wes what are you actually attempting to do?
 
Wes
12:31 PM
comparisons, with support for recursive dependency. got objects working but can't detect recursion with arrays yet
for some reason i get different ReflectionReference::getid
bah. will try again later
i am probably misusing niki's api
$idA = ReflectionReference::fromArrayElement([&$a], 0)->getId();
 
...
 
uh
 
yes, yes you are
You do need that to refer to the original array
 
12:46 PM
I've accepted a project to do (as a freelancer), anyone who has free time and wants to join me? It has a good money (eemm, it is good in Rial, not sure about Dollar)
 
12:57 PM
@NikiC Do you have something to generate GraphViz/DOT markup of a PHP program's abstract syntax tree using ext/ast or PHP-Parser as its source of information?
 
@SebastianBergmann nope
imho it's impractical for anything but the simplest examples
 
@NikiC Okay, thanks. Not the answer I was hoping for :-) Means that I have to implement it myself ... if I really need it.
@NikiC Exactly. I basically want to show the AST for something as simple as if (true) { print '*'; } on a slide. I can do that by hand, I guess.
 
1:15 PM
@SebastianBergmann Yeah, I'd do that by hand
better control of layouting
 
1:51 PM
@NikiC I saw a few weeks ago you had got a new job- where is it that you are working now?
 
@NikiC how much of your work time are you actually spending on working on php-src?
 
@SebastianBergmann I have one for control flow graphs. It would be fairly easy to build one for graphviz
 
2:10 PM
@StatikStasis JetBrains
@bwoebi I'm pretty much exclusively working on php-src and related stuff
 
nice
 
@bwoebi If you have anything in mind I should work on, please tell :D
 
hm :-) I wish to have an interface to rr for php...
But that's maybe something more for @JoeWatkins
@NikiC what I wish for though in PHP is fast string/array processing on the jit side. So that we can actually write competitive logic in php without being 50-100 times slower than a C impl.
 
2:26 PM
@NikiC Nice! Congrats! So do you work on their IDE stuff or something else?
 
15 mins ago, by NikiC
@bwoebi I'm pretty much exclusively working on php-src and related stuff
 
Just read that right afterward...
@NikiC Is having someone on staff that works directly with php-src help them to influence design that is conducive to their developer tools?
I mean I know it is still open-source and language design and decisions are done through rfcs and voting- I guess I am just curious how having someone on staff working with php-src full-time helps them in their mission for making productive software development.
 
2:59 PM
@ircmaxell Would be interested in that, but no pressure.
 
Data-oriented design approach to game development in action from Unity with high performance game demo on iphone - youtube.com/watch?v=alZ6wmwvck0&feature=youtu.be&t=6434
 
@ircmaxell By the way, I recently saw a Kickstarter campaign video by a boardgame designer from Jersey City. Made me think of you. Not because of Jersey City, but he somehow reminded me of you :-) kickstarter.com/projects/gilhova/high-rise-0 is the video.
 
3:29 PM
regarding floating point numbers, is it safe to make simple comparisons between two strings to determine if one is larger than another? (no arithmetic operations being performed here, just determining if one string is larger than another)

I've been using bcmath extension for operations, but don't think I need to use it here.

function compareTwoNumbers(string $foo, string $bar)
{
if ($foo > $bar) {
return 'foo is larger number';
} elseif ($foo === $bar) {
return 'foo and bar are equal';
}
return 'bar is larger number';
 
 
2 hours later…
5:07 PM
@DarrenFelton Your code will break on multiple inputs.
e.g. $foo = '1.2' and $bar = '1.20'
If you changed $foo === $bar to $foo == $bar, it will work.

But it would also allow the inputs $foo = 'b' and $bar = 'a' (result: foo is larger number)

What about...
$foo = (float) $foo;
$bar = (float) $bar;

$messages = [
-1 => 'bar is bigger',
0 => 'bar is equal to foo',
1 => 'foo is bigger'
];
echo $messages[$foo <=> $bar];
sorry... return, not echo
 
@Allenph list of talks yes: docs.basereality.com
@rjhdby you might want to say exactly what you are after then, if you think:
> In step B, the algorithm runs a depth-first search on all possible roots to decrease by one the refcounts of each zval it finds, making sure not to decrease a refcount on the same zval twice (by marking them as "grey"). In step C, the algorithm again runs a depth-first search from each root node, to check the refcount of each zval again. If it finds that the refcount is zero, the zval is marked "white" (blue in the figure).
> If it's larger than zero, it reverts the decreasing of the refcount by one with a depth-first search from that point on, and they are marked "black" again. In the last step (D),
is 'superficial'.
 
5:36 PM
PDO show warning event the PDO::ERRMODE_EXCEPTION has been set – #77716
 
5:55 PM
@Danack I'm really interesting not in theory but in realisation. Especially how GC scheduled. It is separated thread, watching on some state or it runs at any refcount decrement etc.
 
> Dear Barbara Liskov
> In the same way that subtype S may be substituted for supertype T, my love for you has been substituted for hate.
> Your principle has enabled me to waste many hours debugging a test case, wherein said test case erroneously used a subtype.
> I, of course, was not notified, as this was completely valid thanks to your aformentioned principle.
> So take S, and T, and U, and the rest of the alphabet and eat shit.
> Love/hate, Dan
2
 
@DanLugg that probably sounded a lot funnier in your head.
 
@Danack I don't think a lot, but a little perhaps.
/shrug
Also, morning
 
> First of all, the whole reason for implementing the garbage collection mechanism is to reduce memory usage by cleaning up circular-referenced variables as soon as the prerequisites are fulfilled. In PHP's implementation, this happens as soon as the root-buffer is full, or when the function gc_collect_cycles() is called.
If you're looking at the code, then searching for GC_ROOT_BUFFER_MAX_ENTRIES gives some pointers as to where the involved code actually lives.
The 10,000 root objects does have some nasty side effects. If you're only allocating large temporary objects, it's possibly to run out of memory and not have the GC kick in, because there haven't been 10,000 objects created yet, even if 95% of the objects created have been discarded.
 
Wes
6:21 PM
@NikiC what?
\o
if that's a reference it's going to have the same id
 
@SebastianBergmann something like this?
<?php
require __DIR__ . '/vendor/autoload.php';

use PhpParser\ParserFactory;

$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);

try {
    $ast = $parser->parse(file_get_contents(__FILE__));
} catch (Error $error) {
    echo "Parse error: {$error->getMessage()}\n";
    return;
}

$printer = new PHPAstVisualizer\Printer;

$graph = $printer->print($ast);

$graph->export('png', 'test.png');
that graphs that code
 
6:40 PM
1 message moved to Trash
 
6:54 PM
\o
 
Wes
\o
 
7:16 PM
@kuh-chan Thanks for the reply. Regarding the "what about..." with the (float) casting, it's assumed that the only thing passed to the function will already be floating point numbers, as strings. Same concern with $foo = 'b' and $bar = 'a'; Only (string) floating point numbers ever passed in.

Your point about "1.2" and "1.20" are good to bring up, I'll want to be normalizing numbers beforehand. doing a trim on leading & trailing zeros.
 
Hello guys, is it possible to call php function from "function.php" file (located in network 1) using a button from a HTML file name "client.html" (located in network 2).
 
And I rewrote it already
 
7:45 PM
Okay, I need to stop.......
 
8:27 PM
@DarrenFelton trimming 0 could lead to bugs if the one number is zero, the other number is negative.
'-1' > '' === true and '-1' < '' === false. But I don't know if this will change with the currently discussed RFC. In my opinion the explicit cast to float is the cleanest way.
 
Thanks @kuh-chan. I'm adding some notes for those cases.

I'll be adding that to the validation/filter method that handles parsing user input (rather than the greater than comparison). Only greater than zero string values will be passed in
sounds to me (as long as values have been handled for invalid input prior to) that it's safe to compare arbitrary (string) floating point numbers against each other to determine which is greater than the other.
 
9:07 PM
hello guys
 
guys, is there a list where I can see, when deprecated stuff will be removed?
 
Wes
9:25 PM
i give up @NikiC i didn't trash it tho, i will ask you to have a look soon, maybe there's an use case for ReflectionReference::fromVariable or something like that
 

« first day (3066 days earlier)      last day (1896 days later) »