OneHotEncoder handle_unknown='warn' behaves like 'ignore' instead of 'infrequent_if_exist'

### Describe the bug

According to the [documentation](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html), `handle_unknown='warn'` should behave like `handle_unknown='infrequent_if_exist'` (mapping unknown categories to the infrequent category) while emitting a warning.

However, in practice, `handle_unknown='warn'` behaves like `handle_unknown='ignore'` (mapping unknown categories to all zeros).

Documentation states:
> 'warn' : When an unknown category is encountered during transform a warning is issued, and the encoding then proceeds as described for handle_unknown="infrequent_if_exist".

### Steps/Code to Reproduce

```python
import pandas as pd
from sklearn.preprocessing import OneHotEncoder

# Training data with infrequent category
train_data = pd.DataFrame({
    'building_type': ['restaurant']*3 + ['shop']*3 + ['snack']
})

# Test data with unknown category
test_data = pd.DataFrame({
    'building_type': ['restaurant', 'snack', 'casino']  # casino is unknown
})

# Test with 'warn'
encoder_warn = OneHotEncoder(
    handle_unknown='warn',
    sparse_output=False,
    min_frequency=2,
    drop='first'
)
encoder_warn.fit(train_data)
result_warn = encoder_warn.transform(test_data)

# Test with 'infrequent_if_exist'
encoder_infreq = OneHotEncoder(
    handle_unknown='infrequent_if_exist',
    sparse_output=False,
    min_frequency=2,
    drop='first'
)
encoder_infreq.fit(train_data)
result_infreq = encoder_infreq.transform(test_data)

print("Unknown category 'casino' with 'warn':", result_warn[2])
print("Unknown category 'casino' with 'infrequent_if_exist':", result_infreq[2])
```

### Expected Results

```
Unknown category 'casino' with 'warn': [0. 1.]
Unknown category 'casino' with 'infrequent_if_exist': [0. 1.]

Both should map the unknown category to the infrequent category.
```

### Actual Results

```
Unknown category 'casino' with 'warn': [0. 0.]
Unknown category 'casino' with 'infrequent_if_exist': [0. 1.]

'warn' maps to all zeros (like 'ignore') instead of mapping to infrequent.
```

### Versions

```shell
System:
    python: 3.13.3 (tags/v3.13.3:6280bb5, Apr  8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)]
executable: c:\Users\abguv\OneDrive\Desktop\Formation Data Engineer\Projets\Projet 6\analyse\.venv\Scripts\python.exe
   machine: Windows-11-10.0.26200-SP0

Python dependencies:
      sklearn: 1.7.2
          pip: 25.0.1
   setuptools: 80.9.0
        numpy: 2.3.3
        scipy: 1.16.2
       Cython: None
       pandas: 2.3.3
   matplotlib: 3.10.6
       joblib: 1.5.2
threadpoolctl: 3.6.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libscipy_openblas
       filepath: C:\Users\abguv\OneDrive\Desktop\Formation Data Engineer\Projets\Projet 6\analyse\.venv\Lib\site-packages\numpy.libs\libscipy_openblas64_-860d95b1c38e637ce4509f5fa24fbf2a.dll
        version: 0.3.30
threading_layer: pthreads
   architecture: SkylakeX

       user_api: openmp
   internal_api: openmp
    num_threads: 8
         prefix: vcomp
       filepath: C:\Users\abguv\OneDrive\Desktop\Formation Data Engineer\Projets\Projet 6\analyse\.venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libscipy_openblas
       filepath: C:\Users\abguv\OneDrive\Desktop\Formation Data Engineer\Projets\Projet 6\analyse\.venv\Lib\site-packages\scipy.libs\libscipy_openblas-48c358d105077551cc9cc3ba79387ed5.dll
        version: 0.3.29.dev
threading_layer: pthreads
   architecture: SkylakeX
```

COMMENT:
I've submitted PR #32592, which fixes this bug.

After applying the patch, I can confirm the test code now produces the expected output:

```
Sci-kit Learn Version:  1.8.dev0
/Users/nithurshen/Projects/scikit-learn/sklearn/preprocessing/_encoders.py:261: UserWarning: Found unknown categories in columns [0] during transform. These unknown categories will be encoded as the infrequent category.
  warnings.warn(msg, UserWarning)
Unknown category 'casino' with 'warn': [0. 1.]
Unknown category 'casino' with 'infrequent_if_exist': [0. 1.]
```

Thanks for the bug report, @abguven

Labels: Bug, module:preprocessing