Jump to content

Failed to install a module in PHP 5.2.17


jbastarras

Recommended Posts

Hello,
 
I'm having problems with PHP 5.2.17 version installing a module. I get errors ( sintax error '[' ) with these lines

 

$context = stream_context_create($cparams);
  $fp = fopen($url, 'rb', false, $context);
 
  if (!$fp) {
$result = false;
} else {


   $result = stream_get_contents($fp);    
}


if(!$result) {
$result = ['codigo' => 'ERROR', 'descripcion' => 'Error de conexion ', 'tipo' => 'KO];
} else {
switch ($format) {
case 'json':
    $result = json_decode($result, true);
      if ($result === null) {
      $result = ['codigo' => 'ERROR', 'descripcion' => 'Error de conexion, 'tipo' => 'KO'];
      }
      break;
   case 'xml':
      $result = simplexml_load_string($result, true);
      if ($result === null) {
      $result = ['codigo' => 'ERROR', 'descripcion' => 'Error de conexion', 'tipo' => 'KO'];
      }
      break;
}
}

or 

public static function app($key) {
return self::config('app')[$key];
}

Is there any way to do this otherwise to be compatible with both versions ?
 
With 5.3 no problem
 
 
Thank You
 
Regards

 
Link to comment
Share on other sites

Then you should find a new host.  PHP 5.2 is no longer supported and no longer receives updates. 

http://php.net/eol.php

 

If your host will not upgrade, then find a new host.  I realize that is not the answer to your question, but you are focused on the wrong thing.

 

Anyway, what does the function 'config' do?  And what does it return? 

return self::config('app')[$key];
Link to comment
Share on other sites

I am calling an array of app.php file .

 

this is app.php 

?php


return array(
'module_name' => 'module',
'cliente_api' => 'prestashop',
'url' => 'http://localhost:8080/url/ecommerce',
);

And now I want to call the module property . I want return 'module' ( name of may module ) 

 

 

This is a util function that I use all of module of prestashop 

public static function app($key) {
return self::config('app')[$key];
}

But this sentence return self::config('app')[$key]; fail in Php version 5.2.7 

 

 

Thanks 

 

Regards

Link to comment
Share on other sites

Not working ( return nothing )  and It fails also with version 5.3 . With 5.4 works

 

 

 Parse error: syntax error, unexpected '[' in C:\develop\prestashop\modules\module\classes\Util.php on line 10

[PrestaShop] Fatal error in module Util:
syntax error, unexpected '['

 

 

Thanks 

 

Regards

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...