@@ -842,10 +842,13 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
842
842
connection -> info -> lock .fp = php_stream_open_wrapper (lock_name , lock_file_mode , STREAM_MUST_SEEK |REPORT_ERRORS |IGNORE_PATH |persistent_flag , & opened_path );
843
843
if (connection -> info -> lock .fp ) {
844
844
if (is_db_lock ) {
845
- ZEND_ASSERT (opened_path );
846
- /* replace the path info with the real path of the opened file */
847
- zend_string_release_ex (connection -> info -> path , persistent );
848
- connection -> info -> path = php_dba_zend_string_dup_safe (opened_path , persistent );
845
+ if (opened_path ) {
846
+ /* replace the path info with the real path of the opened file */
847
+ zend_string_release_ex (connection -> info -> path , persistent );
848
+ connection -> info -> path = php_dba_zend_string_dup_safe (opened_path , persistent );
849
+ } else {
850
+ error = "Unable to determine path for locking" ;
851
+ }
849
852
}
850
853
}
851
854
if (opened_path ) {
@@ -862,10 +865,10 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
862
865
zval_ptr_dtor (return_value );
863
866
RETURN_FALSE ;
864
867
}
865
- if (!php_stream_supports_lock (connection -> info -> lock .fp )) {
868
+ if (!error && ! php_stream_supports_lock (connection -> info -> lock .fp )) {
866
869
error = "Stream does not support locking" ;
867
870
}
868
- if (php_stream_lock (connection -> info -> lock .fp , lock_mode )) {
871
+ if (! error && php_stream_lock (connection -> info -> lock .fp , lock_mode )) {
869
872
error = "Unable to establish lock" ; /* force failure exit */
870
873
}
871
874
}
0 commit comments