PHP Sadness
PHP Sadness
These are things in PHP which make me sad. They are real, objective issues which I have personally encountered in my normal day-to-day activites. Nothing on this site should be taken to be the view of my employer or is related to my employer in any way.
If you'd like to contact me (in a polite and constructive way), I'm @ericwastl on Twitter.
Update 2018-07-08: Updated reflection argument inspection for PHP 7.0.
Useless Error Reporting
#44 Detail in error messages
#16 Exception thrown without a stack frame
#1 Unexpected T_PAAMAYIM_NEKUDOTAYIM
#7 Parse error: syntax error, unexpected T_SL in...
#54 Empty T_ENCAPSED_AND_WHITESPACE tokens
Inconsistency
#4 Function naming (underscores)
#15 Function naming (prefixes)
#48 Function naming (to/2)
#6 Order of arguments (array manipulations)
#9 Order of arguments (array/string search)
#51 (
#52 Comparison operators
Outright Bugs
#50 Segfault during deep recursion
#13 Segfault with dba_*() functions
#19 (
#22 (documented) The stream_tell() method cannot be overridden with a wrapper
#23 (
#30 Ternary operator associativity
#36 (PDOStatement
#39 Declaring a function called __lambda_func() completely breaks create_function()
#53 (
Cruft
#11 (PHPE9568F34-D428-11d2-A769-00AA001ACF42
#45 Syntax verbosity (arrays and array keys)
Misleading/Confusing topics
#26 (E_ALL = E_ACTUALLY_ALL & ~E_STRICT
#27 Bad function names - parse_str()
#34 mktime() argument order (not inconsistent, just confusing)
#47 Type-coercing comparison operators will convert numeric strings to numbers
#28 The empty($v) function is actually (!isset($v) || $v != true)-and-silence-warnings
Arbitrary Restrictions
#14 Can't throw exceptions from __toString() functions
#25 (func_get_args() function can't be used as a parameter
#38 (
#40 (ob_start() function doesn't allow for a buffer length of 1 ("special value" for 4096)
#43 (array_fill() function doesn't allow length 0
#35 The explode() function won't split with empty string
Anti-Functional Design
#5 Sort functions operate in-place
#12 Functions that do many unrelated things
#21 (
#32 (dubious) Function calls have enormous overhead (15x perl)
#42 Instanceof produces a syntax error on expressions
Missing Features
#17 Standard libc process control (fork/exec/etc)
#20 (\e
#29 Can't decode php-session-format serialization outside a session
#49 (finally-type error handling
Object-Oriented System Issues
#8 Implementing all the right methods (array) still doesn't work in array functions
#18 (intended) Static variables in methods are bound to all instances of the class
#24 Seemingly redundant reflection methods with no documentation
#33 No good way to modify private method behavior in a testing environment
#41 Cannot create a final abstract class
Lexer/Parser Issues
#2 Member variable definition is a constant expression
#31 (
#37 (
#46 Semicolon required at end of block