php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75389 function 'isset' not found when using array_filter
Submitted: 2017-10-16 15:52 UTC Modified: 2017-10-16 15:56 UTC
From: g dot sokol99 at g-sokol dot info Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.1.10 OS: Linux
Private report: No CVE-ID: None
 [2017-10-16 15:52 UTC] g dot sokol99 at g-sokol dot info
Description:
------------
array_filter($some_array, 'isset') cause PHP WARNING.

Test script:
---------------
<?php

$foo = array('a' => 1, 'b' => null);

var_export(array_filter($foo, 'isset');

Expected result:
----------------
array (
  'a' => 1,
)

Actual result:
--------------
PHP Warning:  array_filter() expects parameter 2 to be a valid callback, function 'isset' not found or invalid function name in php shell code on line 1
PHP Stack trace:
PHP   1. {main}() php shell code:0
PHP   2. array_filter() php shell code:1
NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-16 15:54 UTC] g dot sokol99 at g-sokol dot info
- var_export(array_filter($foo, 'isset');
+ var_export(array_filter($foo, 'isset'));
 [2017-10-16 15:56 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2017-10-16 15:56 UTC] requinix@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

http://php.net/manual/en/function.isset.php
> Note: Because this is a language construct and not a function, it cannot be called using variable functions.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 10 14:01:33 2024 UTC