facebookarchive / facebook-instant-articles-sdk-php

The Facebook Instant Articles SDK for PHP provides a native interface for creating and publishing Instant Articles.
https://instantarticles.fb.com/
Other
232 stars 148 forks source link

How to prevent & convert to & when using "withSource"? #239

Closed goodjack closed 6 years ago

goodjack commented 7 years ago

Steps required to reproduce the problem

$adSource = "https://www.facebook.com/adnw_request?placement={$anPlacementId}&adtype=banner300x250";

$instantArticle->getHeader()->addAd(Ad::create()->withSource($adSource));

Expected Result

<figure class="op-ad">
  <iframe src="https://www.facebook.com/adnw_request?placement=PLACEMENT_ID&adtype=banner300x250"></iframe>
</figure>

Actual Result

<figure class="op-ad">
  <iframe src="https://www.facebook.com/adnw_request?placement=PLACEMENT_ID&amp;adtype=banner300x250"></iframe>
</figure>

How to prevent & convert to &amp; when using "withSource"? Thanks.

mustafamasa commented 7 years ago

I'm having the same problem. Did you solve it?

kherlen commented 6 years ago

I'm having the same problem, I think this problem is related with the plugin.

everton-rosario commented 6 years ago

Nice finding! This was not covered into our testcases and indeed this is happening with the SDK itself.

On this PR we can see the issue happening, it is something with the way PHP encodes content while saveXML() is called.