• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Applying source formatting inserts bugs in php code.

Explorer ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

Any way to stop Dreamweaver from formatting PHP code or train it to do it correctly?

When I format my php code it adds spaces in places there should be none, thereby introducing bugs into my code.

For example, line one is how the code should look, line 2 is how it looks after source formatting. Line 2 now inserts spaces before and after so it no longer works.

1 echo "${'Neighborhood'.$x}"

2 echo " ${ 'Neighborhood'.$x} "

Any solutions for this? It makes source formatting extremely dangerous as it introduces a lot of bugs into code.

Views

2.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Mar 01, 2019 Mar 01, 2019

Hi All,

We are happy to inform you we have addressed a couple of PHP source formatting issues in our latest pre release drop 15073.

Please give it a try and share your feedback.

Let us know if it fixes your issues.

Please find the pre release invite link Adobe Prerelease

Thanks

Dreamweaver Team

Votes

Translate

Translate
Community Expert ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

Which version of DW?

Which operating system?

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

Dreamweaver CC 18.0, 10136 Build. I just upgraded yesterday thinking that might help.

Windows 10

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

I can't reproduce it with CC 2018 on Windows 10.    That said, I'm not happy with auto code formatting in 2018 for other reasons but adding spaces to PHP code isn't one of them.  

Double check your Preferences > Code Format > Tab libraries  > PHP

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

Here is the code. You will see how it breaks it. I copied just the code below, nothing else into a new php file, and it breaks it every time.

I did check the Code Format options and they seem right. Thanks


Please let me know if it does not break it for you because if so then it could be a setting issue in Dreamweaver.

<span id="NeighborhoodSpan" style="display: none">

<?php for ($x = 1; $x <= 12; $x++) { ?>

<input name="Neighborhood<?php echo $x?>" type="text" class="SearchFormBox" id="Neighborhood<?php echo $x?>" value="<?php if (${'Neighborhood'.$x}<>'') echo " ${ 'Neighborhood'.$x} "?>" placeholder="Neighborhood <?php echo $x?>" title="Type the first 1 to 3 letters and a drop down list will appear." onBlur="GetSummary()">

<?php } ?>

</span>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

You can see the results below.

Before Auto Formatting:

After Auto Formatting

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

Sorry Nancy, I gave you code that I did not realize Dreamweaver has already broken. Here is a video to show you what is happening and here is the code I used which is not broken.

03.01.2018-12.08.08 Video

<span id="NeighborhoodSpan" style="display: none">

<?php for ($x = 1; $x <= 12; $x++) { ?>

<input name="Neighborhood<?php echo $x?>" type="text" class="SearchFormBox" id="Neighborhood<?php echo $x?>" value="<?php if (${'Neighborhood'.$x}<>'') echo "${'Neighborhood'.$x}"?>" placeholder="Neighborhood <?php echo $x?>" title="Type the first 1 to 3 letters and a drop down list will appear." onBlur="GetSummary()">

<?php } ?>

</span>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

This is definitely a known issue to Adobe.

Checking the bug report forum came up with many instances of this happening and each is in various stages of repair as reported by Adobe reps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

Looks like you accidentally posted the "after" code above, and I see the same thing Nancy does, which is no change, when I Apply Source Formatting.

However, when I take the spaces out of the code, and hit Apply Source Formatting, in CC2018 Build 10136, it adds the space back in just as you're seeing.

Same CC2018 build, under Windows 7.

I've seen reference to a rewrite bug a couple of times, looks like it's also hitting in this situation. My only advice would be to go back to CC2015 where this doesn't happen until Adobe comes out with a fix.

Also be sure to add your voice in the bug report forum.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

Thanks John, you are exactly right. I corrected it above and recorded a video for Nancy or anyone else so they can see this in action. I also provided her with the corrected code.

I am not ready to go back to CC2015, so for now I am not going to use the apply source formatting unless it is on a specific HTML only section.

I will report this bug because if one is not aware of it and applies the source formatting to their php they might find a lot of code that once worked no longer does.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 28, 2018 Mar 28, 2018

Copy link to clipboard

Copied

Is this any closer to being fixed? The formatting option in DW CC 2018 is capable of causing mild inconvenience to completely messing up PHP code, its adding non-breaking spaces and line breaks where it shouldn't, the latter completely breaking code.

Can someone confirm what version of DW you need to roll-back to get an Apply Source Formatting Tool that doesn't screw up PHP code? Does it need to go back to CC 2015 before Brackets was shoe-horned in?

I tested in DW CC 2018 - v18.1 (10155 build), I noticed original poster was using build 10136 , so it seems nothing has been done to date and I don't think the Dreamweaver team think PHP code is important anymore?

Paul-M - Community Expert

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

Energize  ha scritto

Is this any closer to being fixed?

No, it hasn't been fixed yet.

The last build "production-ready" of Dreamweaver is the CC 2015.2 (where you can use in "safety" Apply Source Formatting Tool with php pages).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

BIt of a joke the whole Brackets into Dreamweaver nonsense, we're basicaly relying on third parties and the brackets community to help Adobe fix problems whatt is supposed to be a commecrcial software product.....

Paul-M - Community Expert

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 04, 2018 May 04, 2018

Copy link to clipboard

Copied

I gave up on the current version of Dreamweaver and went back to 2015 over a year ago.

Thought it would be fixed by now - I guess not - what a joke.

I can't even upload a php file without it being corrupted. Totally unusable. Back to 2015 I guess.....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 04, 2018 May 04, 2018

Copy link to clipboard

Copied

I regularly work with PHP code in DW CC without corruptions.

Which OS are you using? 

What type of line breaks are selected in your Preferences?  See screenshot.

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 04, 2018 May 04, 2018

Copy link to clipboard

Copied

I use MacOS 10.13.4

and I tried both Line break types

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 14, 2018 Nov 14, 2018

Copy link to clipboard

Copied

HI,

I'm curious if there has been any improvement on the "bugs" that "apply source formatting" introduces to php code?

In the meantime anyone know of any workarounds for this (like other methods / Mac apps etc)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 14, 2018 Nov 14, 2018

Copy link to clipboard

Copied

No, absolutely no progress.

Adobe usually release only two updates yearly (March and June/July) before of the major upgrade (that correspond autumn of each year, Adobe Max), so we need to wait a lot of time (always that they are working about it).

The only workaround for me is to switch to the previous version 2015 (the last stable version of Dreamweaver).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2018 Nov 14, 2018

Copy link to clipboard

Copied

I have a copy of RapidPHP which I use along with Dreamweaver, its lightweight and has good options for formatting PHP files, also has additional plug-ins for removing empty lines, converting double empty lines to single lines, removing trailing white space etc.

Paul-M - Community Expert

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 14, 2018 Nov 14, 2018

Copy link to clipboard

Copied

Thanks, it seems interesting (RapidPHP) but unfortunately is available only for Windows (I'm a Mac user).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

Hi All,

We are happy to inform you we have addressed a couple of PHP source formatting issues in our latest pre release drop 15073.

Please give it a try and share your feedback.

Let us know if it fixes your issues.

Please find the pre release invite link Adobe Prerelease

Thanks

Dreamweaver Team

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Apr 06, 2019 Apr 06, 2019

Copy link to clipboard

Copied

LATEST

Hi All,

We are happy to inform you we have further stabilized the PHP source formatting issues in our latest prerelease drop 15081.

Please give it a try and share your feedback.

Let us know if it fixes your issues.

Please find the prerelease invite link Adobe Prerelease

Thanks

Dreamweaver Team

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines