What are the common pitfalls when migrating PHP scripts from older versions to PHP7+ that users should be aware of?

One common pitfall when migrating PHP scripts from older versions to PHP7+ is the removal of deprecated features, such as the "mysql_" functions. To solve this issue, users should update their code to use the MySQLi or PDO extension for database interactions.

// Deprecated "mysql_" functions
mysql_connect("localhost", "username", "password");
mysql_select_db("database_name");

// Updated code using MySQLi
$mysqli = new mysqli("localhost", "username", "password", "database_name");

// Check connection
if ($mysqli->connect_error) {
    die("Connection failed: " . $mysqli->connect_error);
}
```

Another common pitfall is the change in error handling, with PHP7+ using exceptions for errors instead of warnings. Users should update their error handling code to catch exceptions and handle them appropriately.

```php
// Old error handling with warnings
if (!$result) {
    trigger_error("Query failed: " . mysql_error(), E_USER_ERROR);
}

// Updated error handling with exceptions
try {
    if (!$result) {
        throw new Exception("Query failed: " . $mysqli->error);
    }
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}