Replace preg_replace With preg_replace_callback Still Failing
<p>I'm working on porting SocialEngine to work on PHP7.</p>

<p>On the default install I get the following error:</p>

<pre><code>preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in 
&lt;b&gt;/home/vagrant/code/mysite/project/app/application/libraries/Scaffold/modules/NestedSelectors/NestedSelectors.php&lt;/b&gt;
on line &lt;b&gt;300&lt;/b&gt;
</code></pre>

<p>The code for that error looks like so:</p>

<pre><code>$xml = preg_replace('/([-_A-Za-z*]+)\s*:\s*([^;}{]+)(?:;)/ie', "'&lt;property name=\"'.trim('$1').'\" value=\"'.trim('$2').'\" /&gt;\n'", $xml);
</code></pre>

<p>I replaced it with <code>preg_replace_callback</code> like so:</p>

<pre><code>$xml = preg_replace_callback('/([-_A-Za-z*]+)\s*:\s*([^;}{]+)(?:;)/ie', function($matches) {
    return "'&lt;property name=\"'.trim('$matches[1]').'\" value=\"'.trim('$matches[2]').'\" /&gt;\n'";
}, $xml);
</code></pre>

<p>and now I get this error:</p>

<pre><code>preg_replace_callback(): The /e modifier is no longer supported, use preg_replace_callback instead in 
&lt;b&gt;/home/vagrant/code/mysite/project/app/application/libraries/Scaffold/modules/NestedSelectors/NestedSelectors.php&lt;/b&gt; 
on line &lt;b&gt;304&lt;/b&gt;
</code></pre>

<p>This seems valid to me, what have I done wrong?</p>