Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Cannot Reproduce
-
8.2
-
None
-
None
-
Linux Ubuntu 16.04LTS
php --version: PHP 7.0.28-0ubuntu0.16.04.1 (cli) ( NTS )
Netbeans 8.2
Description
How to reproduce:
Take the files from the attachment and load the project in netbeans.
Put a breakpoint on the last line (the "echo $var;" line)
Click the "Debug Project" button in netbeans
I run this script from the command line like so:
export XDEBUG_CONFIG="idekey=netbeans-xdebug"
php -d xdebug.remote_enable=1 index.php
Press the green "play" button.
Actual output "Socket Exception occured"
Expected output: not to get this error but to have normal debugging output.
Actual output in the console: Segmentation fault (core dumped)
Expected output in the console: "1"
Now look at line 3. Remove the & in front of $var to make the line look like this:
$anon_function = function() use ($var)
Try this how to reproduce again.
Actual output: no error, everything works fine.
Actual output in the console: "0"
Note: The xdebug.log is included in the tarball, as requested from the error dialog from netbeans.
If you can't get the attachment from this issue:
Create a new netbeans php project (I choose "php project with existing sources").
Have this php script as index.php:
<?php $var = 0; $anon_function = function() use (&$var) { $var++; }; $anon_function(); echo $var;