New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow arbitrary expressions for empty() #54

merged 1 commit into from May 24, 2012


3 participants

nikic commented Apr 12, 2012


This comment has been minimized.


LinusU commented Apr 17, 2012

I think that this is a great idea, thank you for taking the time to implement it!

Allow arbitrary expressions for empty()
This change is as per RFC

The change allows passing the result of function calls and other
expressions to the empty() language construct. This is accomplished by
simply rewriting empty(expr) to !expr.

The change does not affect the suppression of errors when using empty()
on variables. empty($undefinedVar) will continue not to throw errors.
When an expression is used inside empty() on the other hand, errors will
not be suppressed. Thus empty($undefinedVar + $somethingElse) *will*
throw a notice.

The change also does not make empty() into a real function, so using
'empty' as a callback is still not possible.

In addition to the empty() changes the commit adds nicer error messages
when isset() is used on function call results or other expressions.

@php-pulls php-pulls merged commit ec061a9 into php:master May 24, 2012


This comment has been minimized.

php-pulls commented May 24, 2012

Comment on behalf of stas at

merged to master, thanks

1 similar comment

This comment has been minimized.

php-pulls commented May 24, 2012

Comment on behalf of stas at

merged to master, thanks

php-pulls pushed a commit that referenced this pull request Mar 15, 2013

Merge branch 'PHP-5.5'
* PHP-5.5: (101 commits)
  Renamed into
  "ZendOptimizerPlus" is renamed to "opcache" to de merged into PHP-5.5 under ext/opcache (the product name is still "Zend Optimizer+")
  More accurate restart scheduling
  Autogolobal $GLOBALS has to be pinged even if auto_globals_jit=0
  Allow only shared O+ build
  Fixed typos
  add tests into package
  Add test script for #57 (segfaults in drupal7)
  fixed memory leaks
  Fixed Issue #57 (segfaults in drupal7)
  Fixed issue #58 (PHP-5.2 compatibility)
  Allows exclusion of large files from being cached
  Add maintainers inot package.xml
  fix ANSI C90 compat
  Fixed test
  Fixed uninitialized variable
  Fixed bug #64353 (Built-in classes can be unavailable with dynamic includes and Optimizer+)
  Save a stat() call by calling sapi_module.get_stat()
  Fixed #54 (PECL install adds extension= instead of zend_extension= to php.ini)
  release 7.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment