This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 228449 - PHP buffers and javascript output
Summary: PHP buffers and javascript output
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on: 233066
Blocks:
  Show dependency tree
 
Reported: 2013-04-10 15:13 UTC by vpoirier.tech
Modified: 2013-07-25 10:55 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Code snippet (8.41 KB, image/png)
2013-04-10 15:13 UTC, vpoirier.tech
Details
Sample file (11.77 KB, application/octet-stream)
2013-04-11 13:15 UTC, vpoirier.tech
Details
simplified sample file (1.84 KB, application/x-php)
2013-04-11 15:45 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vpoirier.tech 2013-04-10 15:13:19 UTC
Created attachment 133425 [details]
Code snippet

See the attached file, it's a PHP file in which I output javascript code into a buffer to use in the future.
Netbeans seems to believe the javascript "return false;" is a PHP statement in an incorrect place.
That's kinda confusing but I doubt this should be happening since the code is properly written.

Netbeans says "Invalid return statement"

Thank you for any feedback.
Comment 1 Vladimir Riha 2013-04-11 11:56:39 UTC
Hi, do you have installed the latest patch? If not, please try Help->Check for updates and install all updates. There are fixes for mixed languages similar to your sample. I tried this in PHP file


<script>
    function test() {
<?php
ob_start();
if (true) {
    ?>
            console.log("A");
            $("AAA").css("width");
            return false;
    <?php
    echo "A";
}
?>
    }
</script>



and it works in 7.3 with patch. If it doesn't work, then it would be best if you could give us some sample file to reproduce it. There could be problem about return statement outside of function body (already reported).

So please try it and simply reopen this issue. Thanks for reporting


Product Version: NetBeans IDE 7.3 (Build 201302132200)
Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11
System: Linux version 3.2.0-40-generic-pae running on i386; UTF-8; en_US (nb)
Comment 2 vpoirier.tech 2013-04-11 13:15:18 UTC
Created attachment 133458 [details]
Sample file

Here is a sample file with the error.
I am using the latest Netbeans version.

For the context, this function is used inside a PHP class.

Thank you for any feedback. :)
Comment 3 Vladimir Riha 2013-04-11 15:45:58 UTC
Created attachment 133462 [details]
simplified sample file

Thanks for the sample, I tried to simplify it a bit but it is quite mixed code so hopefully I didn't break the JS code.

I also noticed that if I remove all code from line 29 to 37, the error is gone while the removed JS code in these lines shouldn't trigger this change.



Product Version: NetBeans IDE Dev (Build web-main-10285-on-20130411)
Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11
System: Linux version 3.2.0-40-generic-pae running on i386; UTF-8; en_US (nb)
Comment 4 Petr Hejl 2013-07-25 10:55:22 UTC
Fixed by fix for #233066.