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