The successor to PHP 5.6. Use this tag for version-specific issues relating specifically to PHP 7.0.x
Questions tagged [php-7.0]
92 questions
73
votes
8 answers
Silence "Declaration ... should be compatible" warnings in PHP 7
After upgrade to PHP 7 the logs almost choked on this kind of errors:
PHP Warning: Declaration of Example::do($a, $b, $c) should be compatible with ParentOfExample::do($c = null) in Example.php on line 22548
How do I silence these and only these…

sanmai
- 29,083
- 12
- 64
- 76
31
votes
2 answers
Mockery fails with 'Could not load mock ... class already exists' when running with --code-coverage
I am trying to mock a class for phpunit. Php unit fails with the error Could not load mock ... class already exists. This is the only test I'm running, so it can't be the case that the class is mocked already.
Any suggestion would be…

Daniel Becker
- 771
- 1
- 7
- 25
11
votes
1 answer
Adding one microsecond to Datetime object in PHP
I need to add a microsecond to a Datetime object in PHP. I am trying to do it adding a time interfal a fraction of a second to the Datetime but it is not working.
$date = new Datetime('2018-06-05 09:06:46.7487');
$date->add(new…

HellOfACode
- 1,675
- 3
- 18
- 38
7
votes
1 answer
What cause Magento Cloud CLI account login keep on failing?
I set up new environment on a new computer and installed magento cloud cli. And try to login to cloud account by running magento-cloud login but the link for http://127.0.0.1:5000 always return
This site can’t be reached
so I did alternative login…

magekonect
- 81
- 1
- 3
7
votes
0 answers
Laravel 5.5 why is exception not thrown by foreign key violation from delete method?
Update 3: This problem from 9 months ago persists with Laravel 5.8 and Postgresql 11 on Windows 10 in a Laragon environment and Apache 2.4 on an Ubuntu machine. Does the Eloquent Model instance delete() method simply ignore foreign key constraints?…

DavidHyogo
- 2,838
- 4
- 31
- 48
6
votes
2 answers
Ubuntu 14.04: Unable to locate package php7.0-zip
I am not being able to install package php7.0-zip. The error I get after doing
sudo apt-get install php7.0-zip
Is:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package…

Joaquin Colella
- 142
- 1
- 1
- 11
6
votes
1 answer
PHP - Why do different versions of PHP return different results when I use $this as a dynamic variable in isset()?
In PHP 7.0:
$a = 'this';
return isset( $$a );
// returns true
But in PHP 7.1:
$a = 'this';
return isset( $$a );
// returns false
Does anyone know why this happens?

Moein Pakkhesal
- 88
- 1
- 7
5
votes
0 answers
Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) on Phpmyadmin
I am using phpmyadmin with php7.0 but it give error like
Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in /usr/share/php/PhpMyAdmin/MoTranslator/Translator.php on line 58
its working fine with higher php…

Mage2 Beginner
- 53
- 3
4
votes
1 answer
PHP Error session_start() and it says "Unable to clear session lock record"
I have loaded some data using ajax into a div that show the user invoices list. I have to start session to get the user id. It works fine in local host PHP 7.2 but on the server PHP 7.0 It some times says "Unable to clear session lock record" and…

Saff Elli Khan
- 51
- 1
- 5
4
votes
0 answers
@php artisan package:discover handling the post-autoload-dump event returned with error code 255
My local machine (Ubuntu 18.04) has had issues this morning and I've had to repair the git HEAD.
Now, I can use git normally with no errors but I am having to run composer update --no-scripts instead of composer update due to the following…

sdexp
- 756
- 4
- 18
- 36
3
votes
1 answer
Why cURL requests to Telegram Bot API suddenly became very slow?
I have several Telegram bots working nice for years; I used 2 ways to send requests to Bot API:
The first is:
file_get_contents($url);
The second is:
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
…

A. Eaxon
- 157
- 2
- 7
3
votes
3 answers
What is the difference b/w Countable and Non Countable Objects
I am trying out to find difference b/w a countable and a non countable object
First I found out the Type of object
echo gettype($data["current_fiat_currency"]);
Which is a Object
But when i had checked that it is a countable object or not …

Hassan ALi
- 1,313
- 1
- 23
- 51
3
votes
0 answers
Compile mbstring statically into PHP
Is there a way to compile the PHP extension mbstring statically into PHP (PHP >= 7)? Something like ./configure [...] --enable-mbstring=static [...] && make?

devopsfun
- 1,368
- 2
- 15
- 37
2
votes
4 answers
Print emoji/foreign characters in CLI/shell/Terminal using PHP
When I run a script in the terminal containing

Aizzat Suhardi
- 753
- 11
- 19
2
votes
1 answer
PHP does not respect the maximum execution time set
I am running scripts that last longer than the limit allowed by the server and the server does not terminate them.
The phpinfo() showed me that the max_execution_time is set to 30.
Using the ini_get('max_execution_time') feature the value 30 is…

Tom
- 641
- 2
- 8
- 21