# RFC: New error level E_USER_DEPRECATED

- Status: Implemented (PHP 5.3)
- Authors: Lars Strojny lstrojny@php.net
- Date: 2008-07-18
- Version: 1.0
- Original: https://wiki.php.net/rfc/e-user-deprecated-warning
- Page: https://externals.io/rfc/e-user-deprecated-warning
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

## Discussions on the mailing list

- [\[RFC\] E_USER_DEPRECATED](https://externals.io/message/39098.md) — started on 2008-07-19, 10 messages

---

## Introduction

In 5.3 we introduced E\_DEPRECATED to mark internal functions/classes/syntax elements as deprecated with a separate error level. The same deprecation process applies for user level code. That's why we should introduce E\_USER\_DEPRECATED similar to the already present user space levels E\_USER\_WARNING, E\_USER\_NOTICE and E\_USER\_ERROR.

## Proposal and Patch

- 5\_3: [http://lars.schokokeks.org/php/E\_USER\_DEPRECATED.diff](http://lars.schokokeks.org/php/E_USER_DEPRECATED.diff)
- HEAD: [http://lars.schokokeks.org/php/E\_USER\_DEPRECATED-HEAD.diff](http://lars.schokokeks.org/php/E_USER_DEPRECATED-HEAD.diff)

## Use cases

### UC 1: Deprecation warning in a constructor

```php
<?php
class Foo
{
    public function __construct()
    {
        trigger_error('Use Bar instead', E_USER_DEPRECATED);
    }
}
```

### UC 2: Deprecation warning at function call

```php
<?php
function do_something()
{
    trigger_error('Use do_something_else() instead', E_USER_DEPRECATED);
}
```

### UC 3: Deprecation warning when a file is included

```php
<?php
// MY_FUNKY_LIBRARY
trigger_error('Use non-funky library', E_USER_DEPRECATED);
 
...
```
