User tests: Successful: Unsuccessful:
With PHP 7 in active development, I'm trying to be forward looking a bit and look at how compatibility for Joomla's code is affected by changes in the branch. This first PR addresses what is easily the most common difference in PHP 5 and 7 at the moment and should be B/C (unit tests for PHP 5.3 pass with these changes in Framework code that's been updated).
PHP 7 throws an Array to string conversion
error if you are accessing an object with a nested array using syntax like $object->$array['key']
; I haven't researched the exact reason for this but the parser tries to convert the array to a string versus reading the array element. Wrapping the array in curly brackets (like $object->{$array['key']}
) allows the parser to interpret this correctly.
In code that is unit tested, the problematic areas come from the Registry package, JHtmlSelect, JKeychain, and JArrayHelper. These areas are updated with the required changes. A review on extension level code (and untested library code) will need to happen as well.
Also, there appears to be a B/C break with the SimpleXMLElement class and its handling of empty XML nodes between PHP 5 & 7. This needs to be researched also, but it causes fatal errors in the JRegistryFormatXmlTest class, so those tests are skipped for the moment.
This should be well tested on stable PHP versions that the CMS supports (5.3.10+). Below is a gist of how different aspects can be tested:
<select>
element should continue to be populated correctlyThis gist demonstrates the PHPUnit test results pre- and post- patch. Note that the failures are not yet addressed, those will come at a later time.
Labels |
Added:
?
|
Easy | No | ⇒ | Yes |
Category | ⇒ | Libraries |
The stuff in the ArrayHelper class is fixed in the Framework repo, on the 2.x branch specifically and needs backported to the 1.x branch.
As for the rest, it isn't stuff that was covered by automated testing so I didn't include it here. This is really just one big patch to get PHPUnit running on the Vagrant box Rasmus Lerdorf has which can pull in the current PHP 7 branch without me needing to hack up a lot of things and make it easier to start working through some of the incompatibilities.
Also, I'm really trying to do this in smaller chunks and not get to a point where the final patch covers a few hundred files and is practically untestable. Still got plenty of time to work on PHP 7 compatibility
These were all the uses of $foo->bar[...] I could find in the whole repo. So it wouldn't become any larger.
Well if it's that few I'll get what I can updated in a little bit.
That's the spirit :P
I've PR'd the FOF ones into that repo. They'll stay as they are obviously until we update the library next release though
PR updated. JMenu is fixed and Registry and Utilities packages updated.
Looks fine. But 2 things in libraries/vendor/joomla/utilities/src/ArrayHelper.php
:
1) The copyrights in the Framework repo need to be updated. We shouldn't be modifying anything in the libraries/vendor folder; it is all coming from external sources.
2) The Framework isn't using language strings for exceptions.
1) Then why was the year set to 2015 in the file before this PR? Was that a mistake?
2) Ok :)
JM just replaced everything including in all the upstream repo's. Which is why as we update them again we're going back. Generally the CMS rule is only user facing strings need to be translated
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-03-16 21:39:40 |
Milestone |
Added: |
hello friends, the php7 is now stable and i just got it installed for my DEV needs.
on Joomla 3.4.5 we got a problem with String class
/libraries/vendor/joomla/string/src/string.php
abstract class String
to
abstract class StringHelper
now all occurances of
use Joomla/String/String
must be changed to:
use Joomla/String/StringHelper
i am not sure how the autoload works for these files, so if anybody can suggest Git change, pls do so.
now i am trying to get these resolved:
Fatal error: Uncaught TypeError: Argument 1 passed to JErrorPage::render() must be an instance of Exception, instance of Error given in /libraries/cms/error/page.php:28 Stack trace: #0 [internal function]: JErrorPage::render(Object(Error)) #1 {main} thrown in /libraries/cms/error/page.php on line 28
(just a try for PDO since no mysql worked):
Fatal error: Uncaught Error: Cannot instantiate abstract class JDatabaseDriverPdo in /libraries/joomla/database/driver.php:315 Stack trace: #0 /libraries/joomla/factory.php(631): JDatabaseDriver::getInstance(Array) #1 /libraries/joomla/factory.php(329): JFactory::createDbo() #2 /libraries/joomla/session/storage/database.php(69): JFactory::getDbo() #3 [internal function]: JSessionStorageDatabase->write('e8c213614afecab...', '') #4 [internal function]: session_write_close() #5 {main} thrown in /libraries/joomla/database/driver.php on line 315
when trying to use mysqli:
Error displaying the error page: Application Instantiation Error: Could not connect to MySQL.
Hi Guys,
I have a Notice: Array to string conversion in registry.php line 342
I have install xampp7.2.7 and the template is Joomla 2.5
I have solved all the over errors but is stuck with this one.
The current code in the .php file is:
325 // Explode the registry path into an array
325 if ($nodes = explode('.', $path))
327 {
328 // Initialize the current node to be the registry root.
329 $node = $this->data;
330
331 // Traverse the registry to find the correct node for the result.
332 for ($i = 0, $n = count($nodes) - 1; $i < $n; $i++)
333 {
334 if (!isset($node->$nodes[$i]) && ($i != $n))
335 {
336 $node->$nodes[$i] = new stdClass;
337 }
338 $node = $node->$nodes[$i];
339 }
340
341 // Get the old value if exists so we can return it
342 $result = $node->$nodes[$i] = $value;
343 }
344
345 return $result;
Thank you
Another few:
/libraries/cms/menu/menu.php [269, 277]
/libraries/fof/utils/array/array.php [524, 525]
/libraries/vendor/joomla/registry/src/Format/Xml.php [67, 123]
/libraries/vendor/joomla/utilities/src/ArrayHelper.php [499, 500]