Questions tagged [php-5.4]

PHP 5.4 is the successor to PHP 5.3. It was released on March 1, 2012. Use this tag for version-specific issues relating to specifically to PHP 5.4.

PHP 5.4 Changes:

  • Support for traits has been added.
  • Short array syntax has been added, e.g. $a = [1, 2, 3, 4]; or $a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];.
  • Function array dereferencing has been added, e.g. foo()[0].
  • Closures now support $this.
  • <?= is now always available, regardless of the short_open_tag php.ini option.
  • Class member access on instantiation has been added, e.g. (new Foo)->bar().
  • Class::{expr}() syntax is now supported.
  • Binary number format has been added, e.g. 0b001001101.
  • Improved parse error messages and improved incompatible arguments warnings.
  • The session extension can now track the upload progress of files.
  • Built-in development web server in CLI mode.

See Migrating from PHP 5.3.x to PHP 5.4.x for more information.

Information

  • If you want to talk about PHP or if you have a question, you can come to Chat Room 11: PHP.
  • For global question on PHP, please use the generic tag:
402 questions
0
votes
1 answer

download pdf with guzzle

I want to download a pdf file with guzzle. Is this possible? I tried this code: $response = $this->client->post(self::API_BASE_URL.self::API_LABEL_URL, [ 'future' => true, …
0
votes
1 answer

Installation via Composer receives an error with certain dependencies

I'm trying to initialize my symfony project via composer. But I obtain the following error: Problem 1 - Installation request for pugx/shortid-php 1.* -> satisfiable by pugx/shortid-php[1.0.x-dev]. - pugx/shortid-php 1.0.x-dev requires php…
0
votes
1 answer

Assign a function to a class variable in PHP

I can assign a function to a class variable in PHP, i.e. to $this->variable. However, when I try to execute the function, it fails with: FATAL ERROR Call to undefined method a::f() Here is a snippet to illustrate the problem:
IanS
  • 1,459
  • 1
  • 18
  • 23
0
votes
1 answer

PHP Upgrade from 5.4 to 7.2

I am upgrading the PHP version used for a project. Used PHP Code Sniffer to find possible issues with PHP 7.2. How to resolve the following issue ? 1) $this->mbstring_overload = ini_get('mbstring.func_overload') & 2; INI directive…
Shankar
  • 113
  • 1
  • 14
0
votes
1 answer

Cannot add PPA Please check that the PPA name or format is correct

I 'm using ubuntu 12.04 and i want to upgrade my php version from 5.4 to 5.6 Cannot add PPA: 'ppa:ondrej/php'. Please check that the PPA name or format is correct i install the certificat using these command line sudo apt-get install --reinstall…
0
votes
1 answer

Is there any way to connect MSSQL server in PHP without installing any extension

I am trying to connect MSSQL server database on different server using PHP (5.4.45). I already know about sqlsrv_connect() and odbc_connect() and tried them. But we cannot use them without installing their extensions and enabling them in php.ini…
M.Bains
  • 395
  • 1
  • 2
  • 14
0
votes
1 answer

Why the refcount is 3 not 2?

function A($a) { xdebug_debug_zval('a'); } $a = 1; # refcount->1 A($a); # refcount->2 The comment is what I think the refcount should be. but output is: a: (refcount=3, is_ref=0)=1 where is 1 addtional refcount come from?
shingo
  • 18,436
  • 5
  • 23
  • 42
0
votes
0 answers

that code works fine on php5.4 but not in php5.3 how to modify it to work with php5.3

i have joomla site on local server with php5.4 and it works fine but when i upload it to live server it the all site gives error " unexpected [ " on line 491 in example.php when commenting that line it works good but i am not sure if this will…
mohamed
  • 1
  • 1
0
votes
2 answers

Sort array by non-alphabetical, user defined string values

I want to sort an array in a complicated way and am not sure how to go about it. Here is a rough idea of the data I'm working with: [ { target: random.text.cpu-pct-0, otherData[...] }, { target: random.text.cpu-pct-1, otherData[...] }, {…
Bryan
  • 2,951
  • 11
  • 59
  • 101
0
votes
1 answer

Nginx downloading files

I have a server (nginx/1.6.0 PHP 5.5.14) with these settings that works correctly. The problem is when I use the location ^~ /sys/ When I try to access the sys folder it downloads the index. If I remove location ^~ / sys / back to working normally.…
Bruno Andrade
  • 565
  • 1
  • 3
  • 17
0
votes
5 answers

How to remove all null values inside an array, which is enclosed within an associate array, in PHP?

My question may seem fairly simple, but I have tried multiple techniques, and none seem to yield a proper answer. I have an associative array as follows: $array = array("TB1_course" => array(null, 'CHEM 2E03', null, "BIO 1A03"), …
Muhammad
  • 604
  • 5
  • 14
  • 29
0
votes
0 answers

Error in php code after php and mysql upgrades

My server has been upgraded and since then one of my old application is not working PHP from PHP Version 5.04 to PHP Version 5.4.156. MYSQL MySQL database has been upgrade from MySQL version 4.1 to MariaDB Version 5.5.52(MySQL Compatiable). Here am…
Lucky13
  • 11,393
  • 7
  • 25
  • 36
0
votes
1 answer

csv string comparison not working

I'm checking if a string appears in an array filled with fgetcsv(), I've checked the content and the string it's contained at the array but in_array() returns false function checkFieldCSV($index,$code){ $codes = array(); if (($handle =…
Af_doubts
  • 45
  • 7
0
votes
1 answer

Uncaught exception 'PDOException' with 'SQLSTATE[42000] on PHP 5.2 but not in PHP 5.4

Why does the syntax below run in PHP 5.4 but not in PHP 5.2? $stmt = $this->pdo->prepare('SELECT *, COALESCE(( 6371 * acos( cos( radians(:lat_params) ) * cos( radians( tbl_restaurants_restaurants.lat ) ) * cos(…
afazolo
  • 382
  • 2
  • 6
  • 22
0
votes
1 answer

Laravel 5.1 how to make my eloquent query closure secured

what i'm trying to do is to Sum the total deposits of each reservation model, with the condition of less than the amount input in the text. here's my query: $reservations->whereHas('deposits', function($query) use ($etc_filters){ …
jp.palubs
  • 178
  • 1
  • 14