The online racing simulator
PRISM and PHP 7
(22 posts, started )
PRISM and PHP 7
Was reading an article today on the new release of PHP 7. It looks like it might be a somewhat major overhaul for PRISM. I think that moving forward with this project(although I have one more planned release before I start this stuff, considering PHP 7 RC isn't even out till June) and starting to look over code, and debugging stuff to make sure it'll work on PHP 7, How ever, the big question here is backwards compatibility. Due to the fact that PHP 7 is moving to Uniform Variable Syntax, which changes how PHP interprets things like


<?php 
$obj
->$properties['name']
?>

Now this could potentially be avoided and can be made to work on both old and new versions of PHP(which might need to be done). So the main question here is, Are you planning on moving to PHP 7? Once I am able to test PRISM with php 7, I'll have an idea if anything actually needs to be recoded or if it will just work. Hopefully I will have a better idea of what needs to be done to PRISM soon.

One thing I'm kind of looking forward to, which will help greatly with the conversion to using name spacing is the new "Group Use Declarations"


<?php 
#where you will be able to do this:
use Framework\Component\{
     
SubComponent\ClassA,
     
SubComponent\ClassB as ClassC,
     
OtherComponent\ClassD
};
?>

I think overall PHP 7 is going to offer many great features that could potentially help with PRISM's future... including the improved performance.


https://blog.engineyard.com/2015/what-to-expect-php-7
https://blog.engineyard.com/2015/what-to-expect-php-7-2
There has been a lot of PHP7's features I've been drolling over for quite some time. I keep myself up to date on the progress on it with their RFC page as it shows what's going to be in the next version of PHP. I mainly can't wait until I can implement just the parts of modules that I need for plugins. That's going to be awesome.
PHP 7.0.0 Alpha 1 has been released. Time too blow of the PRISM codebase again and upgrade it too all the new hotness.
In the meantime the official PHP7 release is out and even some bugfix releases.

I tested PRISM on PHP7.0.1 (Xampp). It not only doesn't run, it even lets PHP crash completely after it connects to any InSim port. Too bad, PHP7 indeed is a big step forwards.
What's the server you're running this on? OS, and where are you getting PHP from? Building from source, download from a website, apt-get, yum, or pac man?
Is there an error that you can show? A screen shot of what you see when it crashes? Error logs that you can post?
An unhandled win32 exception occured in php.exe [12064]

Unhandled exception at 0x615d80ef in php.exe: 0xC0000005: Access violation reading location 0x00000005.

But, I am quite sure it also happens in a Linux environment.
The Linux version (PHP 7.0.2 (cli) (built: Jan 6 2016 14:50:05) ( NTS )) goes a bit further;

Quote :
[root@xxxxxxxx prism]# php70 camcon.php
Loaded cvars.ini
Loaded hosts.ini
Loaded http.ini
Loaded telnet.ini
Loaded admins.ini
Loaded plugins.ini
Loading plugins
Loading plugin: welcome
Loading plugin: drivertable
Loading plugin: racelog
3 Plugins Loaded.
Connecting to xxx.xxx.xxx.xxx:xxxxx ... #1
Connected to xxx.xxx.xxx.xxx:xxxxx
< IS_VER Packet from camtest.
> TINY_ISM Packet to camtest.
> TINY_SST Packet to camtest.
> TINY_NCN Packet to camtest.
> TINY_NPL Packet to camtest.
> TINY_RES Packet to camtest.
> TINY_GTH Packet to camtest.
> TINY_REO Packet to camtest.
> TINY_RST Packet to camtest.
> TINY_AXI Packet to camtest.
> TINY_NLP Packet to camtest.
> TINY_MCI Packet to camtest.
> TINY_RIP Packet to camtest.
Segmentation fault
[root@xxxxxxxxxx prism]#

The Windows version already crashed after the connected to message.

But there is no error log because PHP itself crashes -badly-.
Awesome! Segmentation faults are fun! I'll submit the bug report to PHP as segfaults are not supposed to happen.
But eehh... Shouldn't there be an investigation how this can happen. Or is this very difficult?

Or do you submit a complete PRISM package to the PHP devs? Tongue
It is very difficult ... But I'm awesome so there's that. Smile

It would be something along the lines of Pull from here download this and run both. Then watch the set fault.
Quote from Dygear :But I'm awesome so there's that. Smile

Haha okay.

TINY_RIP is the last packet being send in the construct of statehandler. What PRISM does after that I don't know, I guess getting ready for receiving but you know it better then me. Wink

* I've read the current bug reports, one of them is about ~E_NOTICE causing segfaults. I turned that off but no effect.
The irony the it dies on an RIP packet.
I assume it could potentially have to do with the way PHP now handles variables. When accessing variables in PHP classes does $class->Variable still work, or do you need to now do $class->$Variable? I haven't had a chance to do any work with PHP7 yet sadly, been busy with work, school, and general life stuff.
$foo->bar is still acceptable:

<?php
class FooBar {
public $foo = 'bar';

public function getFoo()
{
return $this->foo;
}
}

$fooBar = new FooBar();
echo $fooBar->getFoo(), PHP_EOL;



ian@cloud-3:~$ php foo.php
bar

ian@cloud-3:~$ php -v
PHP 7.0.2-1~dotdeb+8.2 (cli) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

Cheers..

Ian
Can't reproduce on Windows 10, with PHP 7.0.3 x64, NTS.
I have a clean linux VM installing on my home server, gonna bring in latest code and test with PHP7 and test as well.
..
Woo! I did some checks to PRISM as pertains to PHP 7 compatibility. Good to see I'm not crazy.
@Dygear but you must have overlooked one. (Fixed now as of 0.5.0.2)
..
-
(ES1) DELETED by ES1 : f

PRISM and PHP 7
(22 posts, started )
FGED GREDG RDFGDR GSFDG