Repository navigation
Conversation
…rn false on Mac OSX 10.8)
|
Hi @smalyshev , Thanks |
btw: after a quick google, seems you have file a bug to apple, then file another bug to ruby.. and the ruby guy told you the same thing I told. why you still think it should be fixed in php self? |
There was a problem hiding this comment.
I think this should be #ifdef'd for affected versions of OS X. Technically, it's possible to create users and groups with blank names (I've just done it on my Ubuntu workstation), and getpwnam("") and getgrnam("") do return valid records at that point.
There was a problem hiding this comment.
Apple should and will fix that. we don't need to
|
Comment on behalf of laruence at php.net: not a php issue |
|
@laruence I'v mentioned that is a bug of OSX, I think it's a workround for that. PHP is a portable language, etc: https://github.com/php/php-src/blob/master/main/rfc1867.c#L310 should be let it go? and I don't close it that quick |
|
as I said: "Linux man page of posix_getpwnam doesn't specific the situation about empty string" that means, technically, it's possible to create users and groups with empty name. so what will happen if apply your fix? we don't fix bugs doesn't belong to PHP. the situation you mentioned is totally different thing, it's the OS specific features. for such a obvious reason, I close it. |
|
and PS: it's not just "technically", LawnGnome 40 minutes ago so why do you think I should not close (quickly) a obvious wrong fix? |
|
Not a critical bug for 5.3. We may discuss adding a fix for 5.4/master, but I'm not feeling too comfortable fixing OS bugs - more we do that, more people expect it from us, and we end up with tons of special checks that don't belong in PHP but belong in OS code. I'd say if OS code returns that, pass it along. Maybe some OS allows empty usernames for some reason. |
Problem: php#176's review found that `cube[9][0]?.clear()` skipped where it must throw on `cube[9]`. The bridge wrapped the whole chain in `?? null` for an inlined method and for a method that changes nothing, and PHP's `??` reads every index in the chain quietly. Only a change's marked index read its container bare. Solution: mago-sharp php#176 now marks the List index directly before `?.` with ZEND_DIM_IS on every path. zend_delayed_compile_dim reads a marked PHP# index with FETCH_DIM_IS and keeps its container a bare read, as zend_compile_sharp_receiver already does. The branch needs ZEND_DIM_SHARP, which only the bridge sets, so plain PHP's opcodes do not change. index_changes gains these rows: - a missing index before `?.` for `insert`, `indexOf`, `last` and `entries`, a `List<Map>` element's `remove` and `has`, and a `List<Set>` element's `add`, `remove`, `clear` and `contains` - a user method on a `List<Point>` element - `cube[9][0]?.` with `add`, `clear`, `remove`, `count`, `contains` and `entries`, each throwing on `cube[9]` Each row fails with its code removed: - Without the new branch, the inlined `clear` rows, `otherSkips` and the property read throw. - With the container read quietly, the nested `clear`, `remove`, `count` and `contains` skip. - With the bridge marking the inner index too, the nested `add` and `entries` skip. Zend/ ├── zend_compile.c zend_delayed_compile_dim reads a ZEND_DIM_IS PHP# index with FETCH_DIM_IS └── tests/sharp/ ├── Grid.sharp otherSkips; nestedAdd, nestedClear, nestedRemove, nestedCount, │ nestedContains and nestedEntries ├── Point.sharp doubled, read through a missing index in read ├── index_changes.inc their rows └── index_changes.phpt their output, with Grid.sharp's and Point.sharp's new line numbers
…Slice 12 note Problem: ruling 7's rule 6 in the Slice 12 note described `?? null` for an inlined method's test and before a method that changes nothing. That read every index in a chain quietly, and php#176's review changed it. Solution: rule 6 states that only the index directly before `?.` reads quietly, marked with ZEND_DIM_IS on every path, that its container stays a bare read, that `?? null` stays only on a Map read, and that the checker types that index nullable. The names tree, the emitted PHP tree and the test list follow. docs/architecture/slices/ └── 12-collection-methods.md ruling 7 rule 6; null_safe_object, read_collection, analyze_member_object and zend_delayed_compile_dim in the names tree; the new index_changes rows
…ypes nullable Problem: php#176's review found two gaps in "a missing List index before `?.` skips the call". - `cube[9][0]?.clear()` skipped where it must throw on `cube[9]`. The test an inlined method runs first, and `null_safe_object` before a method that changes nothing, wrapped the whole chain in `?? null`, and PHP's `??` reads every index in the chain quietly. Only the marked index of a change read the container bare. The six methods gave three different answers, and `clear`, `remove`, `count` and `contains` regressed from master. - The checker typed `rows[9]?.count()` `int`, so `int n = rows[9]?.count()` compiled and threw TypeError at runtime, and the correct `int? n = rows[9]?.count()` was refused as an overly wide type. Solution: - One mark on every path. `null_safe_object` and `read_collection` mark the List index directly before `?.` with ZEND_DIM_IS. The engine (php-sharp #114) reads only that index quietly and keeps its container a bare read. `?? null` stays only on a Map read. A change after `?.` now takes `null_safe_object` too, so `changes_list_element` and `null_safe_index` are gone. - `analyze_member_object` types the List index directly before `?.` nullable, as `check_sharp_map_read` types a Map read. The indexes before it stay bare: `cube[9]` in `cube[9][0]?.x` is not nullable. crates/ ├── sharp-bridge/src/lower.rs null_safe_object marks a List index; read_collection marks the │ index it tests; changes_list_element and null_safe_index deleted ├── sharp-bridge/tests/lower.rs a_null_safe_call_through_nested_list_indexes_marks_only_the_last; │ null_safe_access_reads_a_missing_index_as_null (renamed, with a Map │ row); a_null_safe_change_through_a_list_index_runs_on_the_index ├── analyzer/src/utils/expression/mod.rs analyze_member_object types the List index nullable ├── analyzer/src/expression/array_access.rs check_sharp_map_read's doc comment └── analyzer/tests/sharp.rs a_null_safe_read_through_a_list_index_is_nullable
…hange fix: a change after `xs[i]?.` changes the element the list stores
…arp 164ef44 #114's tests of a change after ?. on a List index need mago-sharp php#176, which types that index nullable and marks it ZEND_DIM_IS. a9f1882, the pin, predates it, so mago compile refused Grid.sharp. The pull goes on to 164ef44, the merge of php#176. That Mago makes event a keyword (php#170), so Log.note's parameter becomes entry. The 20 examples that Mago passes leave sharp/baseline/spec, and no example joins it. Co-Authored-By: Claude <noreply@anthropic.com>
Master brings braces always, case-sensitive keywords, constructors and file-level statements (php#173), `?.` on a List index (php#176), and the Map key checks for groupBy and associateBy (php#166), with php#170 and php#171. The generics slice keeps its type arguments, statics, class values and argument checks on top. 21 files conflicted, and every one keeps both sides. Parse type hints, locals and events with both sides' rules: - The `.sharp` lexer keeps a keyword only in exact lowercase, so `List`, `Class` and `Function` lex as names. The slice's keyword-kind arms for them are dead and are gone. A name followed by `<` starts a generic hint, and a name followed by `(` starts a function hint - A statement may start with `const`, a name or `(`, beside master's `emit`. A local declaration uses master's uppercase-name test - The parse errors keep both NamedConstructorTypeParametersInSharp and MiscasedKeywordInSharp - A method's type parameters live in the arena. With master's `on` clause, `Method` grew past clippy's large_enum_variant limit for ClassLikeMember, and a local's hint already lives in the arena Check Map keys once, with the slice's class-value rule: - A key type is a Map key by the slice's `is_map_key`, so a class value keys no Map. Master's groupBy and associateBy paths, its mixed backed-enum checks and its read-back of keys stay as master wrote them - `get_backing_key_type`, `get_sole_backed_enum` and `ComparisonResult::for_dialect` take the dialect, as the slice changed them, at each of master's new call sites - A groupBy or associateBy key a class value fills is refused with template-constraint-violation, master's code for every key position - The bridge reads a key back through `Types::backed_enum`, and master's duplicate `Lowering::backed_enum` is gone Keep master's other rules beside the slice's: - A typed local checks its type arguments, then reports master's miscased keyword, then an unknown type - A static write through a class value with type arguments goes to the slice's per-type-argument static, and any other write takes master's path - The checker keeps its type parameter, `on` clause and get-only interface property rules in one message each, and drops the stale "a type parameter as a catch type is not supported yet" - The name walker keeps master's `walk_in_on` and the slice's deletion of `walk_in_inheritance` - A `.sharp` call into a plain PHP template bound, `Pick.pair(1, "a")`, is refused once by template-constraint-violation, as the slice reports every PHP# argument outside a bound crates/ ├── syntax/ │ ├── src/cst/cst/class_like/method.rs type parameters in the arena │ ├── src/error.rs both sides' parse errors │ ├── src/parser/internal/ │ │ ├── class_like/method.rs allocates a method's type parameters │ │ ├── event.rs both sides' event forms │ │ ├── local_declaration.rs master's uppercase-name test │ │ ├── statement.rs `emit`, `const`, a name or `(` │ │ └── type_hint.rs a name then `<` or `(` starts a hint │ └── tests/sharp.rs reads the arena type parameters ├── hir/src/lower/error/mod.rs lowers both parse errors ├── names/src/ │ ├── binding.rs passes a method's type parameters on │ └── internal/walker.rs `walk_in_on`, and type parameters ├── semantics/ │ ├── src/internal/checker/sharp.rs one message per member rule │ └── tests/sharp.rs both sides' checker tests ├── analyzer/ │ ├── src/expression/ │ │ ├── assignment/array_assignment.rs master's per-entry check by dialect │ │ ├── call/method_call.rs static writes through a class value │ │ └── instantiation.rs both sides' imports │ ├── src/invocation/ │ │ ├── analyzer.rs both sides' argument checks │ │ └── return_type_fetcher.rs master's groupBy path, the slice's key test │ ├── src/resolver/property.rs both sides' imports │ ├── src/statement/ │ │ ├── function_like/mod.rs `is_map_key` with master's null reason │ │ ├── mod.rs typed locals, Map keys and `emit` │ │ └── return.rs both sides' imports │ ├── src/utils/expression/array.rs backing key type by dialect │ └── tests/sharp.rs one issue per bound and key ├── orchestrator/src/service/incremental_analysis/compile.rs both sides' tests └── sharp-bridge/src/lower.rs key read-back through Types
Fixed bug #62881 (posix_getpwnam("") & posix_getgrnam("") didn't return false on Mac OSX 10.8)
more info about the bug could be found at: https://bugs.php.net/bug.php?id=62881