Allow arbitrary expressions for empty() #54

Merged
merged 1 commit into from May 24, 2012

3 participants

@LinusU

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

@nikic nikic Allow arbitrary expressions for empty()
This change is as per RFC https://wiki.php.net/rfc/empty_isset_exprs.

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.
ec061a9
@php-pulls php-pulls merged commit ec061a9 into php:master May 24, 2012
@php-pulls

Comment on behalf of stas at php.net:

merged to master, thanks

@php-pulls

Comment on behalf of stas at php.net:

merged to master, thanks

@dstogov dstogov pushed a commit that referenced this pull request Mar 14, 2013
@laruence laruence Fixed #54 (PECL install adds extension= instead of zend_extension= to…
… php.ini)
3b78c87
@php-pulls php-pulls pushed a commit that referenced this pull request Mar 15, 2013
@dstogov dstogov Merge branch 'PHP-5.5'
* PHP-5.5: (101 commits)
  Renamed ZendOptimizerPlus.so into opcache.so
  "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
  ...
29a9e13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment