I have an app project with quite a bit of legacy code. I recently upgraded from 8.2 to 8.3 and started running into a problem. At the same time I am migrating some of the app to Laravel and, thus, I am doing some refactoring anyway. Basically some coding techniques that were working fine for years are suddenly generating errors but I can’t tell if it is the server or the php version change that is the cause.
My style has been to concatenate on to a variable ($display_block for example) as the code is parsed but php generated error messages are choking at any and all double quotes. I need to know if this was caused by migrating to 8.3?
The genesis var = (notice all the double quotes) $display_block = ‘<div id=“members_links” style=“background-color:lightgray;”><h3>Place A New Ad Across The Entire CCAN Network</h3></div><div style= “margin: auto; width:80%; padding: 15px; border-radius: 30px; border-style: solid; border-width:10px; border-color: red yellow green blue; background: rgb(15,21,73); background: linear-gradient(90deg, rgba(15,21,73,1) 0%, rgba(15,21,73,1) 35%, rgba(175,202,228,1) 100%);”>’; Subsequent concatenations: $display_block .= ‘<div class=“reg_form_page” style="color: white; "><h1 align=“center”>Confirm Your New Ad Details You Entered For Accuracy</h1> <div class=“reg_form_content”> <form class = “frms” method=“POST” action="https://’ . AGENT_URL . ‘/odp2./process_addALink.php" name=“registerform”>’;
The error code generated by my Laravel always revolves around the use of double quotes (inside an assignment to the $display_block surrounded by single quotes). # ParseError
resources/legacy/opendirectoryproject/dashboard/views/ads.php:162
syntax error, unexpected integer "20"
From what I have heard, that error message is a php generated error message. Here is where things start to make no sense. As part of troubleshooting I started changing my style to where I switch off php to display text and turn php back on to parse php.
What is really weird is that IF the errors are, indeed, generated by php then php is blowing by the closing tag (?>). That can be demonstrated to a point by changing the double to a single quote. The parsing will accept the single quote BUT it is all still outside the php tags. I have walked the errors down the page by changing from double to single quotes.
Another weird fact pointing out that it is a php 8.3 version issue is when I run the code on a php tester (bairesdev.com) and it finds the exact same errors. BUT why does php on their server blow by the closing php ?> and parse non-php code?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
This is not a PHP 8.3 issue. Double quotes inside single-quoted strings have worked the same way since forever and that did not change in 8.3.
The error syntax error, unexpected integer "20" points to something specific on line 162 of that file. The number 20 appearing as an unexpected integer usually means PHP is choking on something like a CSS value or an inline number inside a string that is not actually inside a string anymore because a quote got unbalanced earlier in the file.
The most likely cause is a broken string somewhere above line 162. One unmatched quote earlier in the file causes PHP to misread everything below it, which explains why changing quotes seems to “walk the error down the page”. You are not fixing the real problem, you are just shifting where the parser gets confused.
A few things to try:
Run the file directly through PHP on your server to get the raw error without Laravel’s output wrapping it:
php -l resources/legacy/opendirectoryproject/dashboard/views/ads.php
This will give you the exact line of the actual syntax error, not just where PHP finally gives up.
Also check for any characters that might have gotten corrupted during the Laravel migration, things like curly quotes (" ") instead of straight quotes ("), which can happen when copying code through certain editors or browsers. Those are invisible in some editors but will break PHP parsing immediately.
The fact that an online PHP tester shows the same errors confirms it is a code issue, not a server or version issue.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.